ui: added smart search box
This change switches the search box in the search view from QLineEdit to the derived QtSmartSearchBox implementation, which is capeable of displaying tokens of the query as selectable button elements in different colors. It allows for all the usual mouse and keyboard interactions that the QLineEdit offers. fortune cookie message = Good news from someone dear is coming soon.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
SearchController::SearchController(GraphAccess* graphAccess)
|
||||
: m_graphAccess(graphAccess)
|
||||
, m_ignoreNextMessageActivateToken(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -15,10 +16,12 @@ SearchController::~SearchController()
|
||||
|
||||
void SearchController::handleMessage(MessageActivateToken* message)
|
||||
{
|
||||
if (message->tokenId)
|
||||
if (!m_ignoreNextMessageActivateToken && message->tokenId)
|
||||
{
|
||||
getView()->setText(m_graphAccess->getNameForNodeWithId(message->tokenId));
|
||||
}
|
||||
|
||||
m_ignoreNextMessageActivateToken = false;
|
||||
}
|
||||
|
||||
void SearchController::handleMessage(MessageFind* message)
|
||||
@@ -37,6 +40,8 @@ void SearchController::handleMessage(MessageSearch* message)
|
||||
|
||||
LOG_INFO("search string: \"" + query + "\"");
|
||||
|
||||
m_ignoreNextMessageActivateToken = true;
|
||||
|
||||
std::vector<Id> ids = m_graphAccess->getTokenIdsForQuery(query);
|
||||
if (ids.size())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user