forked from qt-creator/qt-creator
ILocatorFilter: Get rid of accept() method
Change-Id: I3ad3c2cd5cb7a08b7539918b7713bfcd27fde297 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -516,24 +516,6 @@ std::optional<Utils::Tasking::TaskItem> ILocatorFilter::refreshRecipe() const
|
||||
return m_refreshRecipe;
|
||||
}
|
||||
|
||||
/*!
|
||||
Called with the entry specified by \a selection when the user activates it
|
||||
in the result list.
|
||||
Implementations can return a new search term \a newText, which has \a selectionLength characters
|
||||
starting from \a selectionStart preselected, and the cursor set to the end of the selection.
|
||||
|
||||
The default implementation tries to open an editor for \a selections's linkForEditor,
|
||||
if it exists.
|
||||
*/
|
||||
void ILocatorFilter::accept(const LocatorFilterEntry &selection, QString *newText,
|
||||
int *selectionStart, int *selectionLength) const
|
||||
{
|
||||
Q_UNUSED(newText)
|
||||
Q_UNUSED(selectionStart)
|
||||
Q_UNUSED(selectionLength)
|
||||
EditorManager::openEditor(selection);
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the default \a shortcut string that can be used to explicitly choose
|
||||
this filter in the locator input field. Call for example from the
|
||||
|
@@ -225,9 +225,6 @@ public:
|
||||
|
||||
virtual QList<LocatorFilterEntry> matchesFor(QFutureInterface<LocatorFilterEntry> &future, const QString &entry) = 0;
|
||||
|
||||
virtual void accept(const LocatorFilterEntry &selection, QString *newText,
|
||||
int *selectionStart, int *selectionLength) const;
|
||||
|
||||
virtual QByteArray saveState() const;
|
||||
virtual void restoreState(const QByteArray &state);
|
||||
|
||||
|
@@ -1018,15 +1018,9 @@ void LocatorWidget::acceptEntry(int row)
|
||||
return;
|
||||
const LocatorFilterEntry entry = m_locatorModel->data(index, LocatorEntryRole).value<LocatorFilterEntry>();
|
||||
QWidget *focusBeforeAccept = QApplication::focusWidget();
|
||||
AcceptResult result;
|
||||
if (entry.acceptor) {
|
||||
result = entry.acceptor();
|
||||
} else if (entry.filter) {
|
||||
entry.filter->accept(entry, &result.newText, &result.selectionStart,
|
||||
&result.selectionLength);
|
||||
} else {
|
||||
if (!entry.acceptor)
|
||||
EditorManager::openEditor(entry);
|
||||
}
|
||||
const AcceptResult result = entry.acceptor ? entry.acceptor() : AcceptResult();
|
||||
if (result.newText.isEmpty()) {
|
||||
emit hidePopup();
|
||||
if (QApplication::focusWidget() == focusBeforeAccept)
|
||||
|
Reference in New Issue
Block a user