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

QPushButton: button in pressed state if shown in other button's pressed state

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P3: Somewhat important
    • Some future release
    • 4.5.0
    • Core: Event loop
    • None

    Description

      Notice that the second button is in a pressed state after the first is pressed and released.

      -------------------------------------------------------------------------------------------------------------------------------
      #include <QtGui>

      class EventButton : public QPushButton
      {
      public:
      inline EventButton(const QString &text, QWidget *p) : QPushButton(text, p)
      {
      }

      virtual void mousePressEvent(QMouseEvent *ev)

      { qDebug() << Q_FUNC_INFO << text(); QPushButton::mousePressEvent(ev); }

      virtual void mouseReleaseEvent(QMouseEvent *ev)

      { qDebug() << Q_FUNC_INFO << text(); QPushButton::mouseReleaseEvent(ev); }

      };

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

      { button1 = new EventButton("Press 1", this); button2 = new EventButton("Press 2", this); connect(button1, SIGNAL(pressed()), this, SLOT(recreate()), Qt::QueuedConnection); button2->hide(); }

      public slots:
      void recreate()

      { button1->hide(); // handel the input of the first widget (here button1) button2->show(); // for the next input }

      private:
      QPushButton *button1;
      QPushButton *button2;
      };

      #include "main.moc"

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

      Attachments

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

        Activity

          People

            bhughes Bradley T. Hughes (closed Nokia Identity) (Inactive)
            fenglich Frans Englich (closed Nokia identity)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes