16,212
社区成员
发帖
与我相关
我的任务
分享
ContentWindowCL::ContentWindowCL(QWidget *parent):
QMdiSubWindow(parent)
{
setAttribute(Qt::WA_DeleteOnClose);
setWindowTitle("aaaaa");
setObjectName("content");
resize(200,300);
//第1种情况:这样创建的三个部件可以正常布局
// QWidget *titleBarM = new QWidget();
// titleBarM->setStyleSheet("background:green");
// QWidget *toolBarM = new QWidget();
// toolBarM->setStyleSheet("background:yellow");
// QWidget *toolBoxM = new QWidget();
// toolBoxM->setStyleSheet("background:red");
//第2种情况:直接继承自QWidget,带有UI文件,
// CrTitleBarCL *titleBarM = new CrTitleBarCL();
// titleBarM->setStyleSheet("background:green");
// CrToolBarCL *toolBarM = new CrToolBarCL();
// toolBarM->setStyleSheet("background:yellow");
// CrToolBoxCL *toolBoxM = new CrToolBoxCL();
// toolBoxM->setStyleSheet("background:red");
//第3种情况:直接继承QWidget ,没有UI文件
aaa *titleBarM = new aaa();
titleBarM->setStyleSheet("background:green");
bbb *toolBarM = new bbb();
toolBarM->setStyleSheet("background:yellow");
ccc *toolBoxM = new ccc();
toolBoxM->setStyleSheet("background:red");
QLayout *mainLayout = this->layout();
mainLayout->setMargin(2);
mainLayout->setSpacing(2);
mainLayout->addWidget(titleBarM);
mainLayout->addWidget(toolBarM);
mainLayout->addWidget(toolBoxM);
}
PushButton->setAttribute(Qt::WA_StyledBackground,true);
PushButton->setStyleSheet("margin:0px auto;");
PushButton->setAttribute(Qt::WA_StyledBackground,true);
PushButton->setStyleSheet("margin:0px auto;");
PushButton->setAttribute(Qt::WA_StyledBackground,true);
PushButton->setStyleSheet("margin:0px auto;");
PushButton->setAttribute(Qt::WA_StyledBackground,true);
PushButton->setStyleSheet("margin:0px auto;");
PushButton->setAttribute(Qt::WA_StyledBackground,true);
PushButton->setStyleSheet("margin:0px auto;");