[英]Qt Widget Layout Background
i have a layout problem in my Qt Widget 我的Qt小部件中存在布局问题
What i have: 我有的:
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(widget1);
layout->addWidget(widget2);
layout->addWidget(widget3);
this->setLayout(layout);
http://i.stack.imgur.com/p7SvE.png http://i.stack.imgur.com/p7SvE.png
What i want: 我想要的是:
http://i.stack.imgur.com/ANRel.png http://i.stack.imgur.com/ANRel.png
Sorry for posting the images so sucky, but i need 10 reputation for image postings 很抱歉发布图像太烂了,但我需要10声誉的图像发布
I need the Widget 1 behind the other 2 widgets, and full sized. 我需要其他2个小部件后面的小部件1,并且要全尺寸。 It would be perfect when widget 2 and 3 could get some opacity by the stylesheet. 当小部件2和3可以通过样式表获得一些不透明度时,这将是完美的。
Thanks for every help! 感谢您的帮助!
You should create 2 Layout, 您应该创建2版式,
First VLayout for MainWindow and second VLayout for Widget 1 MainWindow的第一个VLayout和Widget 1的第二个VLayout
For example : 例如 :
//If your widget1 size is null set it with setGeometry();
QVBoxLayout *layout = new QVBoxLayout;
layout->addWidget(widget1);
QVBoxLayout *layoutWdg1 = new QVBoxLayout(widget1);
layoutWdg1->addWidget(widget2);
layoutWdg1->addWidget(widget3);
this->setLayout(layout);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.