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

QAbstractButton::pressed emitted although a modal dialog is shown over the button.

XMLWordPrintable

      Run the application below.

      Place the widget on screen so that the modal dialog will open on top of it.

      When you press the button keep the the left mouse button pressed down and then move the mouse so that it is hovering the button that is now under the modal dialog. This will emit new pressed signals for the button so that multiple modal dialogs are shown.

      Code Example:

      #include <QtGui>

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

      { button = new QPushButton("New Window", this); connect(button, SIGNAL(pressed()), this, SLOT(showNewWidget())); }

      public slots:
      void showNewWidget()

      { QWidget* widget = new QWidget(this, Qt::Window); widget->setWindowModality(Qt::WindowModal); widget->resize(400,400); widget->show(); }

      private:
      QPushButton *button;
      };

      #include "main.moc"

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

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

            bhughes Bradley T. Hughes (closed Nokia Identity) (Inactive)
            xcm Martin Petersson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes