Help on QDialog Position
-
when i press the Parent Window's PushButton
i want to show the child dialog window exactly below my pushButton of the Parent Dialog Window,
May i know how to set the position of the Child dialog to fit below the pushButton , even when the Parent dialog is Maximed or Restored.
@
Parent DialogpushBtn ----------
@
-
If the new window is a top level window, you have to use global coordinates.
that means:@
CMyDialog dlg;
dlg.show();QPoint ptGlobal = ui->pushButton->mapToGlobal(QPoint(0, ui->pushButton->height())); QPoint ptLeftTop = mapToGlobal(QPoint(0,0)); QPoint ptFrame = frameGeometry().topLeft(); ptGlobal += (ptLeftTop - ptFrame); // add border size dlg.setGeometry(QRect(ptGlobal, dlg.size())); dlg.exec();
@