Is there a hide property for a button in Qt Creator?

Is there a hide property for a button in the Qt Creator properties palette? I try to find him, but I cannot find him. I need to disable some buttons and hide some. Should I use the property palette for this or do it in the constructor? A custom event will later be included and displayed.

+8
qt qt-creator
source share
3 answers

Some controls have a β€œvisibility” property on the palette, some do not. You can always do this programmatically (for example, in the dialog constructor):

MyButton->setVisible(false); //or true - later in the code 
+14
source share

In older versions of Qt Designer, the visible property was for it. But it seems that it has been removed in new versions, so you cannot use it directly.

But you can still add this field to the .ui file. Just open any text editor, find the part associated with the widgets you need to hide, and paste this block in this place:

 <property name="visible"> <bool>false</bool> </property> 
+2
source share

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

+1
source share

All Articles