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

Wrapped QToolbar

    XMLWordPrintable

Details

    Description

      It would be nice if QToolBar would the ability to automatically wrap to multiple lines like it did in Qt 3.

      To see how it behaves differently in Qt 4.x and Qt 3.x run this example.

      #include <qapplication.h>
      #include <qmainwindow.h>
      #include <qtextedit.h>
      #include <qpixmap.h>
      #include <qstyle.h>
      #include <qtoolbar.h>
      #include <qstring.h>
      #include <qtoolbutton.h>

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      QMainWindow mw;
      mw.setCentralWidget(new QTextEdit(&mw));
      #if QT_VERSION >= 0x040000
      const QPixmap icon = mw.style()->standardPixmap(QStyle::SP_TitleBarCloseButton);
      #else
      const QPixmap icon = mw.style().stylePixmap(QStyle::SP_TitleBarCloseButton);
      #endif
      for (int i=0; i<10; ++i) {
      QToolBar *tb = new QToolBar(QString("Toolbar number %1").arg(i + 1), &mw);
      for (int j=0; j<5; ++j)

      { #if QT_VERSION >= 0x040000 tb->addAction(icon, QString()); #else QToolButton *b = new QToolButton(tb); b->setPixmap(icon); #endif }

      mw.addToolBar(tb);
      }
      mw.show();
      return a.exec();
      }

      When implementing this functionality it would be nice to have something like a QToolBar::shrinkable flag as well. When set to "no", all Items of a toolbar must always be visible
      (like it worked in Qt3), "yes" would imply the now implemented behaviour.

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            rve Anders Bakken
            Votes:
            22 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes