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.
Asked
Active
Viewed 3.0k times
3 Answers
23
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

mimic
- 4,897
- 7
- 54
- 93
-
3How to hide it from the Designer? – Mar 02 '17 at 21:38
-
1@YumYumYum **You can't,** because Qt (Creator|Designer) was intentionally crippled several years ago to prevent users from doing so. Because disabling critical and frankly trivial UI features that *had* been working stably for years is... good? I guess? See [this answer elsewhere](https://stackoverflow.com/a/7843341/2809027) for further commentary. – Cecil Curry Oct 19 '17 at 06:05
-
Did you have a change to look at the answer's date? It's by the way was just 6 year ago :) – mimic Oct 19 '17 at 23:32
-
i still don't see it, and it is 2018 – tofutim Sep 17 '18 at 15:24
5
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>

Ilya
- 4,583
- 4
- 26
- 51
-
1**This is the only sane answer.** See [this answer elsewhere](https://stackoverflow.com/a/7843341/2809027) for similar commentary. It numbs the imagination and the soul that in late 2017, Qt (Creator|Designer) *still* lacks support for hiding and showing widgets. `` – Cecil Curry Oct 19 '17 at 06:02
1
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.

Dr. Snoopy
- 55,122
- 7
- 121
- 140
-
Actually the QT Tutorial writes like submitButton = new QPushButton(tr("&Submit")); submitButton->hide(); I also tried to find one like Visible but couldn't. Can you kindly tell where is it in property pallet ?? – enterprize Jun 23 '11 at 21:54
-
2@enterprize It's not shown in the designer, but the property is there. – Dr. Snoopy Jun 23 '11 at 21:57
-
OK, thank you, probably I can use constructor then. But which property are you saying is not in Designer Hide OR Visible ? As I call hide from constructor & its there – enterprize Jun 23 '11 at 22:02
-
@enterprize visible, hide() is just a function that just does setVisible(false), the same as visible = false. – Dr. Snoopy Jun 24 '11 at 00:21