Home > Back-end >  QT custom window display
QT custom window display

Time:02-26

To solve the
Qt custom a window class, want to in the main window shows a certain size, the result set is not successful only according to the content size
The constructor
LeftWidget: : LeftWidget (QWidget * parent) : QWidget (parent)
{
QLabel * label=new QLabel (this);
The label - & gt; SetText (" text ");
}
Custom window set is not successful, only in accordance with the label size according to
LeftW=new LeftWidget (this);
LeftW - & gt; SetStyleSheet (background - color: white, "");
LeftW - & gt; ,0,300,925 setGeometry (0);

QWidget set to normal display
QWidget * centerW=new QWidget (this);
CenterW - & gt; SetStyleSheet (" background - color: red ");
CenterW - & gt; ,0,400,925 setGeometry (300);
  • Related