mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +01:00
[LocationBar] Fixed rendering selected text with visible popup completer.
This commit is contained in:
parent
7e088d0f1d
commit
ed8ec5ab4a
@ -442,6 +442,14 @@ void LocationBar::keyPressEvent(QKeyEvent* event)
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_A:
|
||||
if (event->modifiers() == Qt::ControlModifier) {
|
||||
if (m_inlineCompletionVisible) {
|
||||
m_inlineCompletionVisible = false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Down:
|
||||
m_completer.complete(text());
|
||||
break;
|
||||
@ -664,7 +672,17 @@ void LocationBar::paintEvent(QPaintEvent* event)
|
||||
cursor.setHeight(cursorHeight);
|
||||
|
||||
style()->drawPrimitive(QStyle::PE_PanelLineEdit, &option, &p, this);
|
||||
p.drawText(textRect, text(), opt);
|
||||
|
||||
QRect actualTextRect = textRect;
|
||||
actualTextRect.setWidth(fontMetrics().width(text()) + 1);
|
||||
|
||||
// When popup is visible, Ctrl + A (Select All) is the only way to select text
|
||||
if (selectedText() == text()) {
|
||||
p.fillRect(actualTextRect, palette().color(QPalette::Highlight));
|
||||
p.setPen(palette().color(QPalette::HighlightedText));
|
||||
}
|
||||
|
||||
p.drawText(actualTextRect, text(), opt);
|
||||
|
||||
if (textRect.contains(cursor.center().x(), cursor.center().y())) {
|
||||
p.fillRect(cursor, option.palette.text().color());
|
||||
|
Loading…
Reference in New Issue
Block a user