diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-09-24 13:58:08 +0200 |
---|---|---|
committer | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-11-15 20:45:24 +0100 |
commit | 360df2cf74410b05d1cab0192f2d0ff5a39db59e (patch) | |
tree | 4a7a7c0b0666e30bb36390857d3905860b647aef /src/widgets/widgets/qcombobox.h | |
parent | 5abb976f23ef0f3cbb7b720e523c08d768c76c0e (diff) |
QComboBox: add property placeholderText
QComboBox had no option to tell the user that he must select an item -
there was no placeholder text like e.g. in QLineEdit. This feature is
widely used in html forms so we should support it also.
Therefore add a new property 'placeholderText' to specify a text which
should be shown when the current selected index is invalid.
[ChangeLog][QtWidgets][QComboBox] QComboBox got a new property
'placeholderText'
Change-Id: If6dac45c9f43455474e267907b0b0d893301c611
Fixes: QTBUG-1556
Fixes: QTBUG-2776
Fixes: QTBUG-77141
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets/widgets/qcombobox.h')
-rw-r--r-- | src/widgets/widgets/qcombobox.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 286772c091..4f89d7f542 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -71,6 +71,7 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget Q_PROPERTY(SizeAdjustPolicy sizeAdjustPolicy READ sizeAdjustPolicy WRITE setSizeAdjustPolicy) Q_PROPERTY(int minimumContentsLength READ minimumContentsLength WRITE setMinimumContentsLength) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) + Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText) #if QT_CONFIG(completer) #if QT_DEPRECATED_SINCE(5, 13) @@ -148,6 +149,9 @@ public: QSize iconSize() const; void setIconSize(const QSize &size); + void setPlaceholderText(const QString &placeholderText); + QString placeholderText() const; + bool isEditable() const; void setEditable(bool editable); void setLineEdit(QLineEdit *edit); |