Details
-
Bug
-
Resolution: Incomplete
-
P2: Important
-
4.8.1, 5.0.0
-
None
-
OpenSUSE 12.2 64 bit; Qt 4.8.1/5.0; GCC 4.7.1; Intel Core i5 2500K; Nvidia GTX 570 driver 310.19
Description
QComboBox can not show popup menu when it is used as item delegate of QTableWidget which is added into QGraphicsView using Qt4.8.x. And the application just crased using Qt5.0. This issue can be reproduced using codes as follow.
class QComboBoxDelegate : public QItemDelegate { Q_OBJECT public: explicit QComboBoxDelegate(QWidget *parent = 0); QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,const QModelIndex &index) const{ QStringList itemList; itemList<<"1"<<"2"<<"3"<<"4"<<"5"; QComboBox *comboBox = new QComboBox(parent); comboBox->addItems(itemList); return comboBox; } void setEditorData(QWidget *editor, const QModelIndex &index) const{} void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const{} void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const{} }; int main(int argc, char *argv[]){ QApplication a(argc, argv); QGraphicsView graphicsView; QGraphicsScene scene; QTableWidget tableWidget(2,2); QComboBoxDelegate itemDelegate; tableWidget.setItemDelegate(&itemDelegate); graphicsView.setScene(&scene); scene.addWidget(&tableWidget); graphicsView.show(); return a.exec(); }
And a source file with main function has been attached.