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

QToolButton hover effect behavior when opening and closing context menu

    XMLWordPrintable

Details

    Description

      Reproduced by the following program:

      #include <QtGui>
      #include <QDebug>

      class Widget : public QWidget
      {
      Q_OBJECT
      public:
      Widget()

      { new QVBoxLayout(this); layout()->addWidget(new QLabel("label")); QToolButton *tb = new QToolButton; tb->setText("tool button"); tb->setAutoRaise(true); layout()->addWidget(tb); connect(tb, SIGNAL(clicked()), SLOT(clicked())); }

      private:
      void popupContextMenu(QPoint pos)

      { QMenu menu(this); menu.addAction("action"); menu.exec(pos); }

      void mousePressEvent(QMouseEvent *event)

      { if (event->buttons() & Qt::RightButton) popupContextMenu(event->globalPos()); }

      private slots:
      void clicked()

      { qDebug() << "clicked ..."; }

      };

      int main(int argc, char *argv[])
      {
      QApplication app(argc, argv);
      Widget w;
      w.show();
      return app.exec();
      }

      #include "main.moc"

      ===================================

      Hover over the tool button and observe the hover effect (the plastique style, for example, would raise the button). Right click to open the context menu and observe that the hover effect now goes away. Is this correct?.
      Now, try two different ways of closing the menu:
      1) Press the Escape key (with the mouse still over the button). The hover effect comes back again.
      2) Move the mouse to a position outside the menu but inside the button. Left click.
      The hover effect is now still off, and the button is not clicked. Is this correct?

      Now, repeat the above exercise, but this time while the window is positioned near the right edge of the screen to cause the popup to be shifted to the left to make it fully visible. This time the hover effect stays on all the time. Is this correct? (The button is still not clicked when closing the menu using technique 2) though)

      Now, open the menu so that it doesn't overlap with the button, and then close it by clicking on the button. This time the hover effect shows (but the button is still not clicked). Is this correct?

      Attachments

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

        Activity

          People

            goffart Olivier Goffart (closed Nokia identity) (Inactive)
            bdo Jo Asplin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes