Details
-
Bug
-
Resolution: Done
-
P2: Important
-
None
-
5.10.0
-
None
Description
The QComboBox collapses immediately under certain circumstances and does not allow user selection. A previous bug mentioned it (QTBUG-66739 https://bugreports.qt.io/browse/QTBUG-66739) but was unable to describe the issue clearly. I have narrowed down the issue.
When I put a QComboBox on a QDialog and set the QDialog flags to Qt::WindowStaysOnTopHint, the issue occurs. It only occurs when the combo box is clicked and then the user selects on another window or the desktop and then returns to click the combo box on the QDialog. Clicking on the previously clicked combo box results in the immediate collapsing issue. All other combo boxes on the QDialog that were not previously clicked will still function properly until they are treated with the previously described behavior.
Code snippet example:
Ui_shpOptions uiShpOptions;
QDialog *shpOptionsDialog;
shpOptionsDialog = new QDialog();
shpOptionsDialog->setWindowFlag(Qt::WindowStaysOnTopHint | Qt::WindowTitleHint);
uiShpOptions.setupUi(shpOptionsDialog);
connect(uiShpOptions.shapeColor, SIGNAL(activated(int)), this, SLOT(shpUpdateColor(int)));
shapeColor = new QComboBox(optionsGrpBox);
shapeColor->setObjectName(QStringLiteral("shapeColor"));
shapeColor->setGeometry(QRect(300, 150, 181, 22));
shapeColor->setEditable(false);
shapeColor->setMaxVisibleItems(8);
shapeColor->setMaxCount(20);
uiShpOptions.shapeColor->insertItem(0, "Red");
uiShpOptions.shapeColor->insertItem(1, "Orange");
uiShpOptions.shapeColor->insertItem(2, "Cyan");
uiShpOptions.shapeColor->insertItem(3, "Green");
uiShpOptions.shapeColor->insertItem(4, "White");
uiShpOptions.shapeColor->insertItem(5, "Pink");
uiShpOptions.shapeColor->insertItem(6, "Gray");
uiShpOptions.shapeColor->insertItem(7, "Yellow");
uiShpOptions.shapeColor->insertItem(8, "Random");