mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 10:46:35 +01:00
parent
eb583d429b
commit
780106ddd0
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -43,6 +43,11 @@ void LocationCompleter::setLocationBar(LocationBar* locationBar)
|
|||||||
m_locationBar = locationBar;
|
m_locationBar = locationBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LocationCompleter::isPopupVisible()
|
||||||
|
{
|
||||||
|
return s_view->isVisible();
|
||||||
|
}
|
||||||
|
|
||||||
void LocationCompleter::closePopup()
|
void LocationCompleter::closePopup()
|
||||||
{
|
{
|
||||||
s_view->close();
|
s_view->close();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* ============================================================
|
/* ============================================================
|
||||||
* QupZilla - WebKit based browser
|
* QupZilla - WebKit based browser
|
||||||
* Copyright (C) 2010-2012 David Rosca <nowrep@gmail.com>
|
* Copyright (C) 2010-2013 David Rosca <nowrep@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -35,6 +35,8 @@ public:
|
|||||||
explicit LocationCompleter(QObject* parent = 0);
|
explicit LocationCompleter(QObject* parent = 0);
|
||||||
|
|
||||||
void setLocationBar(LocationBar* locationBar);
|
void setLocationBar(LocationBar* locationBar);
|
||||||
|
|
||||||
|
bool isPopupVisible();
|
||||||
void closePopup();
|
void closePopup();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -591,6 +591,33 @@ void LocationBar::hideProgress()
|
|||||||
|
|
||||||
void LocationBar::paintEvent(QPaintEvent* event)
|
void LocationBar::paintEvent(QPaintEvent* event)
|
||||||
{
|
{
|
||||||
|
if (m_completer.isPopupVisible()) {
|
||||||
|
// We need to draw cursor
|
||||||
|
LineEdit::paintEvent(event);
|
||||||
|
|
||||||
|
QStyleOptionFrameV3 option;
|
||||||
|
initStyleOption(&option);
|
||||||
|
|
||||||
|
int lm, tm, rm, bm;
|
||||||
|
getTextMargins(&lm, &tm, &rm, &bm);
|
||||||
|
|
||||||
|
QRect contentsRect = style()->subElementRect(QStyle::SE_LineEditContents, &option, this);
|
||||||
|
contentsRect.adjust(lm, tm, -rm, -bm);
|
||||||
|
|
||||||
|
const QFontMetrics &fm = fontMetrics();
|
||||||
|
|
||||||
|
QString textPart = text().left(cursorPosition()) + " ";
|
||||||
|
int cursorXpos = lm + fontMetrics().width(textPart);
|
||||||
|
int cursorYpos = contentsRect.y() + (contentsRect.height() - fm.height() + 1) / 2;
|
||||||
|
int cursorWidth = style()->pixelMetric(QStyle::PM_TextCursorWidth, &option, this);
|
||||||
|
int cursorHeight = fontMetrics().height();
|
||||||
|
|
||||||
|
QPainter p(this);
|
||||||
|
QRect cursorRect(cursorXpos, cursorYpos, cursorWidth, cursorHeight);
|
||||||
|
p.fillRect(cursorRect, option.palette.text().color());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hasFocus() || text().isEmpty() || m_forceLineEditPaintEvent) {
|
if (hasFocus() || text().isEmpty() || m_forceLineEditPaintEvent) {
|
||||||
LineEdit::paintEvent(event);
|
LineEdit::paintEvent(event);
|
||||||
if (m_forceLineEditPaintEvent) {
|
if (m_forceLineEditPaintEvent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user