Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65540

QComboBox , QFontDialog,etc. popup not shown when used as editor for item view embedded in graphics scene

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 4.8.6, 4.8.7, 5.0.0, 5.0.1, 5.0.2, 5.1.0 , 5.1.1, 5.2.0, 5.2.1, 5.3.0, 5.3.1, 5.3.2, 5.4.0, 5.4.1, 5.4.2, 5.5.0, 5.5.1, 5.6.0, 5.6.1, 5.6.2, 5.6.3, 5.6, 5.7.0, 5.7.1, 5.7, 5.8.0, 5.8, 5.9.0, 5.9.1, 5.9.2, 5.9.3, 5.10.0 RC2, 5.10.0 RC3, 5.10.0 Alpha, 5.10.0 Beta 1, 5.10.0 Beta 2, 5.10.0 Beta 3, 5.10.0 Beta 4, 5.10.0 RC, 5.10.0, 5.9.4
    • Widgets: GraphicsView
    • None

    Description

      #include "mainwindow.h"
      #include <QApplication>
      #include <QComboBox>
      #include <QGraphicsView>
      #include <QStyledItemDelegate>
      #include <QTableView>
      #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(); }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            bibr Andreas Aardal Hanssen
            feng 强森 冯
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes