Improve behavior of ButtonOverlay
* Remove all existing actions when falling back to using a custom layout to prevent duplicating those buttons * Enable clear button of ClearComboBox by default for consistency with other widgets
This commit is contained in:
parent
ee9ec87386
commit
106ac4c57e
|
@ -324,7 +324,7 @@ void ButtonOverlay::fallbackToUsingCustomLayout()
|
|||
QPixmap infoPixmap;
|
||||
QString infoText;
|
||||
QList<QAction *> actions;
|
||||
if (auto const *le = lineEditForWidget()) {
|
||||
if (auto *const le = lineEditForWidget()) {
|
||||
if ((clearButtonEnabled = le->isClearButtonEnabled())) {
|
||||
setClearButtonEnabled(false);
|
||||
}
|
||||
|
@ -336,6 +336,9 @@ void ButtonOverlay::fallbackToUsingCustomLayout()
|
|||
disableInfoButton();
|
||||
}
|
||||
actions = le->actions();
|
||||
for (auto *const action : actions) {
|
||||
le->removeAction(action);
|
||||
}
|
||||
}
|
||||
|
||||
// initialize custom layout
|
||||
|
|
|
@ -27,6 +27,7 @@ ClearComboBox::ClearComboBox(QWidget *parent)
|
|||
: QComboBox(parent)
|
||||
, ButtonOverlay(this, getComboBoxLineEdit(this))
|
||||
{
|
||||
ButtonOverlay::setClearButtonEnabled(true);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in New Issue