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

QTabBar: When changing the tab text it should not cause the tabbar to scroll if the tab is still visible

XMLWordPrintable

      QTabBar: When changing the tab text it should not cause the tabbar to scroll if the tab is still visible.

      In the following test case simply scroll and watch it get scrolled back when the timer fires.

      Test case main.cpp to reproduce
      ================================
      #include <QtGui>

      class MyTabBar : public QTabBar
      {
      Q_OBJECT
      public:
      MyTabBar(QWidget *parent = 0) : QTabBar(parent), count(0)

      { addTab("Foo"); addTab("Progress: 0%"); addTab("Bar"); addTab("Baz"); addTab("Long tab, long tab"); addTab("Long tab, long tab"); QTimer *t = new QTimer(this); connect(t, SIGNAL(timeout()), this, SLOT(changeText())); t->start(1000); }

      public slots:
      void changeText()

      { count++; setTabText(1, QString("Progress: %1").arg(count)); }

      private:
      int count;
      };

      class MyTabWidget : public QTabWidget
      {
      public:
      MyTabWidget(QWidget *parent = 0) : QTabWidget(parent) {}
      void setTabBar(QTabBar *tb)

      { QTabWidget::setTabBar(tb); }

      };

      #include "main.moc"

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      MyTabWidget tw;
      MyTabBar *mtb = new MyTabBar(&tw);
      tw.setTabBar(mtb);
      tw.show();
      return a.exec();
      }

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

            ntg Pierre Rossi
            anshaw Andy Shaw (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes