Is
In A function of the
QWidget * B=new QWidget (this);
In the function of B
QPushButton * C=new QPushButton (this);
So how can I make C on A Widget shows?
thank you
CodePudding user response:
A need A layout
A - & gt; SetLayout (new QVBoxLayout (this));
B need a layout
M_pVBLayout=new QVBoxLayout (this);
A - & gt; SetLayout (m_pVBLayout);
QPushButton * C=new QPushButton (this);
M_pVBLayout - & gt; AddWidget (C);
C is displayed
CodePudding user response:
Thank you, I tryCodePudding user response:
Why not directly put the C in A inside? If you want to B to C, this relationship can be placed at the same level to deal withCodePudding user response:
Both are added this parameter, A C is not in ACodePudding user response:
QPushButton * C=new QPushButton (this);Pointer to the parent class C is this namely QWidgets, so start running when the parent window button C is start, hope to adopt ~ ~
CodePudding user response:
Thank you?? Has been resolved!