Is there a hide property for pushbutton in Qt Crea

2019-04-22 13:13发布

Is there a hide property for pushbutton in Qt Creator property pallet? I am trying to find one but I am not able to find. I need to make some buttons disable & some hide. Should I use property pallet for it OR do it in constructor? Later on user event, they will be enable & shown.

标签: qt qt-creator
3条回答
一纸荒年 Trace。
2楼-- · 2019-04-22 13:37

There is no property called hide, but there is one called "visible" that does what you want. See the QWidget (Since QPushButton is a QWisget) docs for more information.

查看更多
唯我独甜
3楼-- · 2019-04-22 13:42

In old versions of Qt Designer there was a property visible for it. But it seems that it was removed in new versions, so you can't use it directly.

But it is still possible to add this field in the .ui file. Just open any text editor, find the part related to the widget you need to hide, and insert this block in that place:

<property name="visible">
   <bool>false</bool>
</property>
查看更多
不美不萌又怎样
4楼-- · 2019-04-22 13:46

Some controls have "visibility" property on the palette, some don't. You always may do that programmatically (for example in the dialog's constructor):

MyButton->setVisible(false); //or true - later in the code
查看更多
登录 后发表回答