-
Bug
-
Resolution: Fixed
-
P4: Low
-
6.7.3, 6.9.1
-
None
-
Windows 11, Version 10.0.26100 Build 26100, x86_64
Qt built from source with MinGW, GCC 14.2.0
When a QComboBox is added as an item widget to a QTreeWidget, and the QTreeWidget itself is inside a QScollArea, clicking on the combo box on Windows 11 will turn the entire combo box black. This does not occur on Windows 10 or earlier, or on Linux or macOS.
Code to reproduce:
#include <QApplication> #include <QWidget> #include <QTreeWidget> #include <QTreeWidgetItem> #include <QComboBox> #include <QScrollArea> #include <QVBoxLayout> #include <memory> int main(int argc, char** argv) { QApplication app(argc, argv); QScrollArea window; window.setWindowTitle("Reproducer"); QWidget* container = new QWidget(); auto layout = new QVBoxLayout(container); window.setWidget(container); window.setWidgetResizable(true); auto treeWidget = new QTreeWidget(container); layout->addWidget(treeWidget); treeWidget->setColumnCount(2); treeWidget->setHeaderLabels({"Setting", "Value"}); auto item1 = new QTreeWidgetItem(); item1->setText(0, "Setting 1"); treeWidget->addTopLevelItem(item1); auto combo1 = new QComboBox(); combo1->addItem("Hello"); combo1->addItem("World"); combo1->addItem("Goodbye"); treeWidget->setItemWidget(item1, 1, combo1); window.show(); return app.exec(); }
After running this program, simply click on the combo box, it will show the drop down, but it will be entirely black (both the drop down and the combo box itself). The interaction with the combo box still works as expected (i.e. you can select the items if you guess where they are), but nothing is displayed.
Screenshot before clicking:
Screenshot after clicking:
Screenshot after closing the dropdown:
Resizing / repainting has no effect here once the QComboBox has entered this state. Other QComboBoxes in the same QTreeWidget are not affected until they are clicked themselves, but once each is clicked, they remain black.
This might also affect other widgets than QComboBox.
Note that the QTreeWidget must be in a QScrollArea itself (so basically double QScrollArea), otherwise this bug will not occur.
This could be related to QTBUG-123722, where a change was reverted for Qt 6.7.0, but only for the non Windows 11 style, because the issue there could not be reproduced on Windows 11.
- relates to
-
QTBUG-123722 QComboBox shown with black popup background
-
- Closed
-