The code is as follows:
Public mainDialog: public QDialog
{
Q_OBJECT
Public:
MainDialog (QDialog * parent=nullptr);
~ mainDialog ();
Private slots:
Void clickedOnSubDialog ();
Private:
QPushButton * m_button;
};
Public subDialog: public QDialog
{
Q_OBJECT
Public:
SubDialog (QDialog * parent=nullptr);
~ subDialog ();
}
MainDialog: : mainDialog (QDialog * parent) : QDialog (parent)
{
M_button=new QPushButton (QString (" next dialog "), this);
M_button - & gt; The resize (40, 30);
M_button - & gt; Move (this - & gt; Width () * 50/100, this - & gt; Height () * 40/100);
The connect (m_button, & amp; QPushButton: : clicked, this, & amp; MainDialog: : clickedOnSubDialog);
}
MainDialog: : ~ mainDialog ()
{
}
Void mainDialog: : clickedOnSubDialog ()
{
SubDialog DLG.
Int res=DLG. The exec ();
If (res!=QDialog: : Accepted)
{
return ;
}
}
SubDialog: : subDialog (QDialog * parent) : QDialog (parent)
{
}
SubDialog: : ~ subDialog ()
{
}
,, can you tell me the code above is what m_button, click on the button pop up child dialogs have not in the middle of the mainDialog is show? Don't know is there any way to make it appear in the main dialog per click locations are right in the middle?
CodePudding user response:
DLG manually move to the middle first, then the execCodePudding user response: