Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.5.1
-
None
Description
Consider the following:
A QTableView has an item delegate which provides QComboBoxes as editors. The table view is embedded into a QGraphicsScene, but when a combo box editor is shown, its popup is never shown when the user clicks on the combo box arrow.
Note that the problem only seems to occur when the user tries to click on the combo box arrow with the mouse. When invoking the combo box editor with keys, the combo box popup is shown as expected.
The problem does not occur with an embedded top-level combo box, either.
The following example demonstrates the problem:
#include <QtGui> class Delegate : public QStyledItemDelegate { Q_OBJECT public: Delegate(QObject *parent = 0) : QStyledItemDelegate(parent) { } QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const { QComboBox *cb = new QComboBox(parent); cb->addItem("foo"); cb->addItem("bar"); cb->addItem("foobar"); return cb; } }; #include "main.moc" int main(int argc, char **argv) { QApplication app(argc, argv); QTableView *table = new QTableView; QStandardItemModel *model = new QStandardItemModel(4, 1, table); Delegate *delegate = new Delegate(table); table->setModel(model); table->setItemDelegate(delegate); QGraphicsView view; QGraphicsScene *scene = new QGraphicsScene; scene->addWidget(table); view.setScene(scene); view.show(); return app.exec(); }