ui: edit search element on backspace instead of deleting (issue #681)

This commit is contained in:
Eberhard Graether
2019-03-20 14:47:39 +01:00
parent b02064a160
commit 5d672fafc4
3 changed files with 6 additions and 16 deletions
@@ -17,7 +17,7 @@ TaskExecuteCustomCommands::TaskExecuteCustomCommands(
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider, std::unique_ptr<IndexerCommandProvider> indexerCommandProvider,
std::shared_ptr<PersistentStorage> storage, std::shared_ptr<PersistentStorage> storage,
std::shared_ptr<DialogView> dialogView, std::shared_ptr<DialogView> dialogView,
int indexerThreadCount, size_t indexerThreadCount,
const FilePath& projectDirectory const FilePath& projectDirectory
) )
: m_indexerCommandProvider(std::move(indexerCommandProvider)) : m_indexerCommandProvider(std::move(indexerCommandProvider))
@@ -227,7 +227,7 @@ void TaskExecuteCustomCommands::runIndexerCommand(std::shared_ptr<IndexerCommand
MessageShowStatus().dispatch(); MessageShowStatus().dispatch();
MessageStatus( MessageStatus(
L"command \"" + indexerCommand->getCustomCommand() + L"\" returned code \"" + std::to_wstring(result) + L"\"" + L"command \"" + indexerCommand->getCustomCommand() + L"\" returned code \"" + std::to_wstring(result) + L"\"" +
L" with message \"" + errorMessage + L"\"" + L" with message \"" + errorMessage + L"\"" +
L" and output \"" + processOutput + L"\".", true, false, true).dispatch(); L" and output \"" + processOutput + L"\".", true, false, true).dispatch();
} }
} }
@@ -24,7 +24,7 @@ public:
std::unique_ptr<IndexerCommandProvider> indexerCommandProvider, std::unique_ptr<IndexerCommandProvider> indexerCommandProvider,
std::shared_ptr<PersistentStorage> storage, std::shared_ptr<PersistentStorage> storage,
std::shared_ptr<DialogView> dialogView, std::shared_ptr<DialogView> dialogView,
int indexerThreadCount, size_t indexerThreadCount,
const FilePath& projectDirectory); const FilePath& projectDirectory);
private: private:
@@ -41,12 +41,12 @@ private:
std::unique_ptr<IndexerCommandProvider> m_indexerCommandProvider; std::unique_ptr<IndexerCommandProvider> m_indexerCommandProvider;
std::shared_ptr<PersistentStorage> m_storage; std::shared_ptr<PersistentStorage> m_storage;
std::shared_ptr<DialogView> m_dialogView; std::shared_ptr<DialogView> m_dialogView;
const int m_indexerThreadCount; const size_t m_indexerThreadCount;
const FilePath m_projectDirectory; const FilePath m_projectDirectory;
TimeStamp m_start; TimeStamp m_start;
bool m_interrupted = false; bool m_interrupted = false;
int m_indexerCommandCount; size_t m_indexerCommandCount;
std::vector<std::shared_ptr<IndexerCommandCustom>> m_serialCommands; std::vector<std::shared_ptr<IndexerCommandCustom>> m_serialCommands;
std::vector<std::shared_ptr<IndexerCommandCustom>> m_parallelCommands; std::vector<std::shared_ptr<IndexerCommandCustom>> m_parallelCommands;
std::mutex m_parallelCommandsMutex; std::mutex m_parallelCommandsMutex;
+1 -11
View File
@@ -283,8 +283,7 @@ void QtSmartSearchBox::keyPressEvent(QKeyEvent* event)
} }
else if (!hasSelectedText() && cursorPosition() == 0 && m_cursorIndex > 0) else if (!hasSelectedText() && cursorPosition() == 0 && m_cursorIndex > 0)
{ {
m_elements[m_cursorIndex - 1]->setChecked(true); editElement(m_elements[m_cursorIndex - 1]);
deleteSelectedElements();
return; return;
} }
} }
@@ -595,15 +594,6 @@ void QtSmartSearchBox::onTextEdited(const QString& text)
} }
} }
if (!match.name.empty() && lastMatchIsNoFilter())
{
if (!m_matches.empty())
{
matchesChanged = true;
}
clearMatches();
}
if (matchesChanged) if (matchesChanged)
{ {
setEditText(QString::fromStdWString(match.getFullName())); setEditText(QString::fromStdWString(match.getFullName()));