[英]How to add dynamic qlabel
I am not good about qt design. 我对qt设计不好。 I want to create qlabels dynamically. 我想动态创建qlabels。
I want to create group of two qlabel with horizontal layout. 我想创建两个带有水平布局的qlabel组。 And next qlabels will be added vertically. 接下来的qlabel将被垂直添加。
Here is an example; 这是一个例子。
QLabel1 QLabel2
QLabel3 QLabel4
QLabel5 QLabel6
....
..
.
I want to add them with coding. 我想用编码添加它们。 And put it in frame_result
In picture you will see frame_result has vertical layout already 并将其放在frame_result
在图片中,您将看到frame_result已经具有垂直布局
Could you please help me how to do. 您能帮我怎么做。 I already spent lots of time with coding backbone of face recognition system. 我已经花了很多时间在人脸识别系统的编码主干上。
You could dynamically add QHBoxLayout
's to QFormLayout
: 您可以将QHBoxLayout
的动态添加到QFormLayout
:
QFormLayout *formLayout = new QFormLayout;
QHBoxLayout *hBox = new QHBoxLayout;
hBox->addWidget( new QLabel( "Label one", this ));
hBox->addWidget( new QLabel( "Label two", this ));
formLayout->addRow( hBox );
this->setLayout( formLayout );
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.