Avoid creating unnecessary event loops

The `exec()` method will create another event loop and transfer
control over there which might introduce unexpected bugs.
This commit is contained in:
Chocobo1
2019-06-03 15:10:19 +08:00
parent 206bb018dd
commit 3748b995ff
22 changed files with 509 additions and 476 deletions

View File

@@ -358,7 +358,9 @@ void SearchJobWidget::showFilterContextMenu(const QPoint &)
const Preferences *pref = Preferences::instance();
QMenu *menu = m_lineEditSearchResultsFilter->createStandardContextMenu();
menu->setAttribute(Qt::WA_DeleteOnClose);
menu->addSeparator();
QAction *useRegexAct = new QAction(tr("Use regular expressions"), menu);
useRegexAct->setCheckable(true);
useRegexAct->setChecked(pref->getRegexAsFilteringPatternForSearchJob());
@@ -367,7 +369,7 @@ void SearchJobWidget::showFilterContextMenu(const QPoint &)
connect(useRegexAct, &QAction::toggled, pref, &Preferences::setRegexAsFilteringPatternForSearchJob);
connect(useRegexAct, &QAction::toggled, this, [this]() { filterSearchResults(m_lineEditSearchResultsFilter->text()); });
menu->exec(QCursor::pos());
menu->popup(QCursor::pos());
}
QString SearchJobWidget::statusText(SearchJobWidget::Status st)