Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-3370

QTabBar : setUsesScrollButtons not working like expected?

    XMLWordPrintable

Details

    • 8fb9ed08c60b667737a9ae1b209da61fe9c67200

    Description

      Sometimes when setting setUsesScrollButtons on a QTabBar to false, it will still appear. It seems that as soon as you put this widget in another widget this setting is ignored. If you set it after it has been put into its parent widget it does work.

      #include <QtGui>
      int main(int argc, char* argv[]){
      QApplication app(argc, argv);

      QTabWidget tabWidget;
      QWidget* pWidget = new QWidget;
      pWidget->setObjectName("test1");
      QWidget* pWidget2 = new QWidget;
      pWidget2->setObjectName("test12");
      QWidget* pWidget3 = new QWidget;
      pWidget3->setObjectName("test13");
      QWidget* pWidget4 = new QWidget;
      pWidget4->setObjectName("test14");

      pWidget->setProperty("name","test QTabBar");
      tabWidget.addTab(pWidget, "foo");
      tabWidget.addTab(pWidget2, "foo");
      tabWidget.addTab(pWidget3, "foo");
      tabWidget.addTab(pWidget4, "foo");
      tabWidget.setUsesScrollButtons(false);
      tabWidget.setStyleSheet("QTabBar::tab

      { color: yellow;}

      QTabBar::tab:test1

      { color: red;}

      ");
      tabWidget.show();

      QTabBar *RecordTabBar = new QTabBar();
      RecordTabBar->setGeometry(QRect(358, 337, 691, 61));
      RecordTabBar->addTab("Tab 1");
      RecordTabBar->addTab("Tab 2");
      RecordTabBar->addTab("Tab 3");
      RecordTabBar->addTab("Tab 4");
      RecordTabBar->setStyleSheet("QTabBar::tab

      { color: yellow;}

      QTabBar::tab:test1

      { color: red;}

      ");
      RecordTabBar->setUsesScrollButtons(false);
      RecordTabBar->show();
      return app.exec();
      }

      This behavior is hardly consistent.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            engvolds Morten Engvoldsen (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes