ModelView programing with Delegate in qt
-
When I create QSpinBox in createEditor() of QStyleItemDelegate class,It displays in side the cell of the QTableview.
But when I create QDialog in that function,It gets display out side(seperatly).What could be the reason? -
@hjohn
Hi
A dialog is a windows type and not embeddable as a widget.
You can just use QWidget as base class and it will work.
Since you want to put it inside the cell, QDialog is not the right base class. -
@hjohn
Hi
Its just 2 place to change in code then its Qwidget.
No reason to recreate it all again. very easy to switch.In .h
class mine : public QDialog <<< the actual baseand in .cpp
mine::mine(QWidget *parent) : QDialog(parent), << change the call to base for constructormaybe #include <QWidgets> instead of QDialog
Note:
there is also
myDialog->setWindowFlags(Qt::Widget)
after you construct the dialog.
It might do the same. not tested. though.