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

Status tips of context-menu QActions not shown in statusbar

    XMLWordPrintable

Details

    Description

      QActions with status tips set should display a status tip in the status bar any time a QAction is used. This means not only in menubars but in context menus as well. Currently status tips will only work in a context menu when a QAction is parented to the main window and even then Bug #225198 occurs. Support for using QAction::statusTip should be more universal, and not just with a MenuBar's menu.

      Example:

      #include <QtGui>

      class MainWindow : public QMainWindow
      {
      Q_OBJECT
      public:
      MainWindow(QWidget *parent = 0)
      : QMainWindow(parent)

      { setStatusBar(new QStatusBar); QAction *act1 = new QAction("Act 1", 0); act1->setStatusTip("This is Action 1"); QAction *act2 = new QAction("Act 2", 0); act2->setStatusTip("This is Action 2"); QAction *act3 = new QAction("Act 3", 0); act3->setStatusTip("This is Action 3"); QMenu *menuBarMenu = menuBar()->addMenu("Menu Bar Menu"); menuBarMenu->addAction(act1); menuBarMenu->addAction(act2); menuBarMenu->addAction(act3); contextMenu = new QMenu("Context Menu", this); contextMenu->addAction(act1); contextMenu->addAction(act2); contextMenu->addAction(act3); contextMenu->setMouseTracking(true); setContextMenuPolicy(Qt::CustomContextMenu); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showContextMenu(QPoint))); }

      private slots:
      void showContextMenu(const QPoint &pos)

      { contextMenu->exec(mapToGlobal(pos)); }

      private:
      QMenu *contextMenu;
      };

      #include "main.moc"

      int main(int argc, char **argv)
      {
      QApplication a(argc, argv);
      MainWindow mw;
      mw.show();
      return a.exec();
      }

      Attachments

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

        Activity

          People

            vfm Thierry Bastian (closed Nokia identity) (Inactive)
            janichol Andy Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes