I have a QGraphicsView subclass where, on context menu on an item, I want to show a Properties dialog.
I would like the dialog to be centered in the view...
As I have it now, with no parent, it is shown in the center of the screen.
MyView::MyView(QWidget *parent) : QGraphicsView(parent) {}
void MyView::showProperties()
{
TabDialog *tabDialog = new TabDialog(); // shows in center of screen
// TabDialog *tabDialog = new TabDialog(this); // doesn't show at all
// TabDialog *tabDialog = new TabDialog((QWidget*)this->parent()); // doesn't show at all
tabDialog->setWindowFlags(Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint);
tabDialog->exec();
delete tabDialog;
}
The view is placed in a groupbox... so the parent is the groupbox...
How can I call the dialog using a parent ?