View Full Version : Default visible text descriptor on widgets like QSpinBox and QComboBox

6th July 2010, 16:57

I'm wondering if it's possible to have some kind of default text descriptor on widgets like the QSpinBox and QComboBox so that before you even use the control, that text is shown. As an example, if I have a QComboBox which allows you to select different countries, then the default text would show "Country", but it would not be an option once you collapse the combobox. Is this at all easily possible in Qt?

6th July 2010, 20:16
Bump....... :)

8th July 2010, 16:22
One more bump I guess...

26th April 2012, 14:40

I'm searching for this...

27th April 2012, 11:12
Wow, that's an old timer :)

As far as I know there's no such functionality out-of-a-box in qt.
First item added to the combobox is displayed as currently selected item.

You could create your own widget using QPushButton and QListWidget (as a popup).

In fact for spin box you can do something like that:

spinBox->setSpecialValueText( "Some Default Text" );
This text will be displayed when spinbox value is equal to minimum.