fix(ui): fix compilation with Qt 5.9

Qt 5.9 lacks QLineEdit::selectionEnd().
This commit is contained in:
Oleg Shparber 2019-03-25 01:36:36 -04:00
parent 5ef5111bd9
commit 343c7ce078

View File

@ -73,7 +73,12 @@ void SearchEdit::selectQuery()
const int pos = hasSelectedText() ? selectionStart() : cursorPosition();
const int queryPos = queryStart();
const int textSize = text().size();
#if QT_VERSION >= 0x050A00 // 5.10.0
if (pos >= queryPos && selectionEnd() < textSize) {
#else
const int selectionEnd = hasSelectedText() ? pos + selectedText().size() : -1;
if (pos >= queryPos && selectionEnd < textSize) {
#endif
setSelection(queryPos, textSize);
return;
}