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

setEnabled(false) on action returned from QToolBar::addWidget() does not always work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P3: Somewhat important P3: Somewhat important
    • 4.6.0
    • 4.2.3
    • Widgets: Main Window
    • None

      Calling setEnabled(false) on action returned from QToolBar::addWidget() does not work if the added widget contains other actions like in the following example.

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

      QMainWindow win(0);
      QToolBar *toolbar = new QToolBar(&win);
      win.addToolBar(toolbar);

      QMenu *mymenu = new QMenu(&win);
      QAction *mAction = mymenu->addAction("Bar");

      QToolButton *button = new QToolButton(toolbar);
      button->setPopupMode(QToolButton::InstantPopup);
      button->setText("Foo");
      button->setMenu(mymenu);

      QAction *a = toolbar->addWidget(button);

      //this does not work
      a->setEnabled(false);

      //this works
      //toolbar->widgetForAction(a)->setEnabled(false);

      win.show();
      return app.exec();
      }

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

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes