简体   繁体   中英

How to hide QLabel by default in QtDesigner

I've been working on project in Visual Studio and QtDesigner.
I want to set QLabel(pixel, mm) be invisible by default. Someone have any idea ?

It is not possible to set QWidget visible-property in QtDesigner, see this question : Initially hidden control in Qt Creator .

You need to do this through the code, in your parent constructor after initializing the UI objects:

ui->setupUi(this);
[...]
ui->myLabel->setVisible(false);

您无法控制visible属性,但是如果要使QLabel默认为不可见,只需将width/height属性设置为0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM