Details
-
Bug
-
Resolution: Invalid
-
P2: Important
-
4.4.0
-
None
Description
Consider the following:
If a QComboBox, cb1, is placed above a sibling QComboBox, cb2, cb1's popup may appear underneath cb2. The popup should appear above any of its parent's siblings.
Update: In Graphics View, the popup is a child of cb1, and so its stacking order relative to cb2 is the same as that of cb1's parent. If the parent is under cb2, then the popup will also be. This is not a bug, but it's certainly unexpected and not what you want. We can make it work better by introducing a flag that ensures that items are always stacked on top (of everything). This flag would then be enabled by default for all popups.
The following example should reproduce the problem (only reproduced on Windows, not on Linux). The problem seems related to creation order.
Test case main.cpp to reproduce
==============================
#include <QApplication>
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QGraphicsProxyWidget>
#include <QComboBox>
#include <QVariant>
void add_combo(QGraphicsScene& scene, int x, int y)
{
QComboBox* combo = new QComboBox;
combo->insertItem(0, "123");
combo->insertItem(0, "ABC");
combo->insertItem(0, "DEF");
combo->setEnabled(true);
combo->setEditable(true);
QGraphicsProxyWidget* pw = new QGraphicsProxyWidget;
pw->setWidget(combo);
pw->setPos(x, y);
scene.addItem(pw);
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QGraphicsScene scene;
QGraphicsView view(&scene);
scene.setSceneRect(0, 0, 200, 200);
add_combo(scene, 10, 10);
add_combo(scene, 10, 40);
add_combo(scene, 80, 10);
add_combo(scene, 80, 40);
view.show();
return app.exec();
}