Properly reset on ESC key on LayoutBox/CategorizedCombo

Fix for bug #12497.
This commit is contained in:
Daniel Ramoeller 2022-02-27 20:33:48 +01:00 committed by Jean-Marc Lasgouttes
parent 8e8825baa7
commit 7bdf372ecc
4 changed files with 7 additions and 0 deletions

View File

@ -370,6 +370,7 @@ void CategorizedCombo::Private::countCategories()
void CategorizedCombo::showPopup()
{
lastCurrentIndex_ = currentIndex();
bool enabled = view()->updatesEnabled();
view()->setUpdatesEnabled(false);
@ -400,6 +401,7 @@ bool CategorizedCombo::eventFilter(QObject * o, QEvent * e)
case Qt::Key_Escape:
if (!modified && !d->filter_.isEmpty()) {
d->resetFilter();
setCurrentIndex(lastCurrentIndex_);
return true;
}
break;

View File

@ -74,6 +74,8 @@ private:
struct Private;
///
Private * const d;
///
int lastCurrentIndex_;
};

View File

@ -401,6 +401,7 @@ void LayoutBox::Private::countCategories()
void LayoutBox::showPopup()
{
lastCurrentIndex_ = currentIndex();
d->owner_.message(_("Enter characters to filter the layout list."));
bool enabled = view()->updatesEnabled();
@ -425,6 +426,7 @@ bool LayoutBox::eventFilter(QObject * o, QEvent * e)
case Qt::Key_Escape:
if (!modified && !d->filter_.isEmpty()) {
d->resetFilter();
setCurrentIndex(lastCurrentIndex_);
return true;
}
break;

View File

@ -60,6 +60,7 @@ private:
friend class LayoutItemDelegate;
class Private;
Private * const d;
int lastCurrentIndex_;
};
} // namespace frontend