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

qmenu with qwidgetaction doesn't un-highlight the normal action when the mouse is on the widget action

    XMLWordPrintable

Details

    Description

      The following code can be used to reproduce the problem:

      #include <QApplication>
      #include <QLabel>
      #include <QMenu>
      #include <QDebug>
      #include <QStyle>
      #include <QStyleOption>
      #include <QPushButton>
      #include <QWidgetAction>
      
      int main(int argc, char* argv[])
      {
              QApplication app(argc, argv);
      
              QPushButton button("Click");
              QMenu* menu = new QMenu(&button);
              button.setMenu(menu);
      
              QLabel* label = new QLabel("widget action #1", menu);
              label->setStyleSheet(":hover{color:red; background-color:palette(highlight);}");
              QWidgetAction* labelAction = new QWidgetAction(menu);
              labelAction->setDefaultWidget(label);
              menu->addAction(labelAction);
      
              label = new QLabel("widget action #2", menu);
              labelAction = new QWidgetAction(menu);
              labelAction->setDefaultWidget(label);
              menu->addAction(labelAction);
      
              menu->addAction("action #1");
              menu->addAction("regular action #2");
      
              button.show();
      
              return app.exec();
      }
      
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            sanonymous Nokia Qt Support (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes