int SearchEdit::queryStart() const { Zeal::SearchQuery currentQuery = Zeal::SearchQuery::fromString(text()); // Keep the filter for the first esc press if (currentQuery.keywordPrefixSize() > 0 && currentQuery.query().size() > 0) return currentQuery.keywordPrefixSize() + 1; else return 0; }
void SearchEdit::focusInEvent(QFocusEvent *event) { // Focus on the widget. QLineEdit::focusInEvent(event); // Override the default selection. Zeal::SearchQuery currentQuery = Zeal::SearchQuery::fromString(text()); int selectionOffset = currentQuery.keywordPrefixSize(); if (selectionOffset > 0) selectionOffset++; // add the delimeter setSelection(selectionOffset, text().size() - selectionOffset); m_focusing = true; }
int SearchEdit::queryStart() const { const Zeal::SearchQuery currentQuery = Zeal::SearchQuery::fromString(text()); // Keep the filter for the first Escape press return currentQuery.query().isEmpty() ? 0 : currentQuery.keywordPrefixSize(); }