# HG changeset patch # User Wuzzy # Date 1522118371 -7200 # Node ID f816b9e73fcb99c3da964ad2e9af2361ba5f63a8 # Parent b13071610c077384f20e0b578d2e957b10c53271 ThemeFilterProxyModel: Fix filter function containing a path with no return value diff -r b13071610c07 -r f816b9e73fcb QTfrontend/model/ThemeFilterProxyModel.cpp --- a/QTfrontend/model/ThemeFilterProxyModel.cpp Mon Mar 26 15:12:33 2018 +0200 +++ b/QTfrontend/model/ThemeFilterProxyModel.cpp Tue Mar 27 04:39:31 2018 +0200 @@ -33,29 +33,28 @@ bool ThemeFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex & sourceParent) const { + QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); + bool searchOkay = true; + if(!filterRegExp().isEmpty()) + { + // Check regular expression set by the theme chooser search + QString name = index.data(ThemeModel::ActualNameRole).toString(); + int in = filterRegExp().indexIn(name); + searchOkay = in != -1; + } + if(isFilteringDLC || isFilteringHidden) { - QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); bool isDLC = index.data(ThemeModel::IsDlcRole).toBool(); bool isHidden = index.data(ThemeModel::IsHiddenRole).toBool(); - if( - ((isFilteringDLC && !isDLC) || !isFilteringDLC) && - ((isFilteringHidden && !isHidden) || !isFilteringHidden)) - { - if(!filterRegExp().isEmpty()) - { - // Also check regular expression set by the theme chooser search - QString name = index.data(ThemeModel::ActualNameRole).toString(); - int index = filterRegExp().indexIn(name); - return index != -1; - } - else - return true; - } + + return ( ((isFilteringDLC && !isDLC) || !isFilteringDLC) && + ((isFilteringHidden && !isHidden) || !isFilteringHidden) ) && + searchOkay; } else { - return true; + return searchOkay; } } diff -r b13071610c07 -r f816b9e73fcb QTfrontend/ui/widget/themeprompt.cpp --- a/QTfrontend/ui/widget/themeprompt.cpp Mon Mar 26 15:12:33 2018 +0200 +++ b/QTfrontend/ui/widget/themeprompt.cpp Tue Mar 27 04:39:31 2018 +0200 @@ -121,7 +121,7 @@ // Cancel button (closes dialog) QPushButton * btnCancel = new QPushButton(tr("Cancel")); - connect(btnCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(btnCancel, SIGNAL(clicked()), this, SLOT(onRejected())); // Select button QPushButton * btnSelect = new QPushButton(tr("Use selected theme")); @@ -170,9 +170,16 @@ list->moveRight(); } +void ThemePrompt::onRejected() +{ + reject(); + filterModel->setFilterFixedString(QString()); +} + void ThemePrompt::onAccepted() { themeChosen(list->currentIndex()); + filterModel->setFilterFixedString(QString()); } // When a theme is selected diff -r b13071610c07 -r f816b9e73fcb QTfrontend/ui/widget/themeprompt.h --- a/QTfrontend/ui/widget/themeprompt.h Mon Mar 26 15:12:33 2018 +0200 +++ b/QTfrontend/ui/widget/themeprompt.h Tue Mar 27 04:39:31 2018 +0200 @@ -54,6 +54,7 @@ private slots: void onAccepted(); + void onRejected(); void themeChosen(const QModelIndex & index); void filterChanged(const QString & text); void moveUp();