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

QComboBox uncheck the QToolButton

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.6.1
    • None
    • Windows 10 64 bits, core i5-3330 and 4GB RAM

    Description

      1. Create a QToolButton dynamically
      2. Select the setDown to true
      3. Create a QComboBox dynamically
      4. Add items to show any popup
      5. Add both in the layout (any layout)

      By clicking in the QComboBox the QToolButton is automatically unchecked (or setDown to false).

      Example with problem:

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
          QToolButton* testButton = new QToolButton(this);
      
          QComboBox* combo = new QComboBox(this);
          combo->addItem("TEST 1");
          combo->addItem("TEST 2");
          combo->addItem("TEST 3");
          combo->addItem("TEST 4");
      
          testButton ->setDown(true);
      
          ui->layoutButtons->addWidget(testButton);
          ui->layoutButtons->addWidget(combo);
      }
      

      Obs: But this problem has to do with the order the buttons are added, only the first widget is affected by the combo.

      Example without problem:

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow)
      {
          ui->setupUi(this);
      
          QToolButton* testButton = new QToolButton(this);
          QToolButton* testButton_2 = new QToolButton(this);
      
          QComboBox* combo = new QComboBox(this);
          combo->addItem("TEST 1");
          combo->addItem("TEST 2");
          combo->addItem("TEST 3");
          combo->addItem("TEST 4");
      
          testButton_2->setDown(false);
          testButton->setDown(true);
      
          ui->layoutButtons->addWidget(testButton_2);
          ui->layoutButtons->addWidget(testButton);
          ui->layoutButtons->addWidget(combo);
      }
      

      Attachments

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

        Activity

          People

            mmutz Marc Mutz
            felipefuerback Felipe Fuerback
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes