forked from qt-creator/qt-creator
Locator: Cancel running search when closing
When closing e.g. a separate window with a locator search running, we don't need the search to continue. Save resources by cancelling it. Change-Id: I889b9cd163a9cc79045fb0eda9797856c489bd39 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -623,6 +623,13 @@ LocatorWidget::LocatorWidget(Locator *locator) :
|
|||||||
updateFilterList();
|
updateFilterList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LocatorWidget::~LocatorWidget()
|
||||||
|
{
|
||||||
|
// no need to completely finish a running search, cancel it
|
||||||
|
if (m_entriesWatcher->future().isRunning())
|
||||||
|
m_entriesWatcher->future().cancel();
|
||||||
|
}
|
||||||
|
|
||||||
void LocatorWidget::updatePlaceholderText(Command *command)
|
void LocatorWidget::updatePlaceholderText(Command *command)
|
||||||
{
|
{
|
||||||
QTC_ASSERT(command, return);
|
QTC_ASSERT(command, return);
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class LocatorWidget
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LocatorWidget(Locator *locator);
|
explicit LocatorWidget(Locator *locator);
|
||||||
|
~LocatorWidget() override;
|
||||||
|
|
||||||
void showText(const QString &text, int selectionStart = -1, int selectionLength = 0);
|
void showText(const QString &text, int selectionStart = -1, int selectionLength = 0);
|
||||||
QString currentText() const;
|
QString currentText() const;
|
||||||
|
|||||||
Reference in New Issue
Block a user