1
mirror of https://invent.kde.org/network/falkon.git synced 2024-09-21 17:52:10 +02:00

LocationBar: Fixed drawing cursor at correct position with popup opened.

This commit is contained in:
nowrep 2013-02-22 00:25:13 +01:00
parent 2a5ff86972
commit 64e6c36ed4

View File

@ -552,7 +552,6 @@ void LocationBar::hideProgress()
void LocationBar::paintEvent(QPaintEvent* event)
{
#ifndef Q_OS_MAC
if (m_completer.isPopupVisible() && !m_completer.showingMostVisited()) {
// We need to draw cursor when popup is visible
// But don't paint it if we are just showing most visited sites
@ -569,8 +568,8 @@ void LocationBar::paintEvent(QPaintEvent* event)
const QFontMetrics &fm = fontMetrics();
QString textPart = text().left(cursorPosition()) + " ";
int cursorXpos = lm + fontMetrics().width(textPart);
QString textPart = text().left(cursorPosition());
int cursorXpos = lm + fontMetrics().width(textPart) + 3;
int cursorYpos = contentsRect.y() + (contentsRect.height() - fm.height() + 1) / 2;
int cursorWidth = style()->pixelMetric(QStyle::PM_TextCursorWidth, &option, this);
int cursorHeight = fontMetrics().height();
@ -583,7 +582,6 @@ void LocationBar::paintEvent(QPaintEvent* event)
p.fillRect(cursorRect, option.palette.text().color());
return;
}
#endif
if (hasFocus() || text().isEmpty() || m_forceLineEditPaintEvent) {
LineEdit::paintEvent(event);