mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
Force a LineEdit::paintEvent after a setCursorPosition, in order to
trigger a recalculation of the visible text rect.
This commit is contained in:
parent
4fce161414
commit
e08428a6d1
|
@ -55,6 +55,7 @@ LocationBar::LocationBar(QupZilla* mainClass)
|
||||||
, m_holdingAlt(false)
|
, m_holdingAlt(false)
|
||||||
, m_loadProgress(0)
|
, m_loadProgress(0)
|
||||||
, m_progressVisible(false)
|
, m_progressVisible(false)
|
||||||
|
, m_forceLineEditPaintEvent(false)
|
||||||
{
|
{
|
||||||
setObjectName("locationbar");
|
setObjectName("locationbar");
|
||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
|
@ -110,6 +111,7 @@ void LocationBar::setWebView(TabbedWebView* view)
|
||||||
void LocationBar::setText(const QString &text)
|
void LocationBar::setText(const QString &text)
|
||||||
{
|
{
|
||||||
LineEdit::setText(text);
|
LineEdit::setText(text);
|
||||||
|
m_forceLineEditPaintEvent = true;
|
||||||
setCursorPosition(0);
|
setCursorPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -423,6 +425,7 @@ void LocationBar::focusOutEvent(QFocusEvent* event)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_forceLineEditPaintEvent = true;
|
||||||
setCursorPosition(0);
|
setCursorPosition(0);
|
||||||
hideGoButton();
|
hideGoButton();
|
||||||
|
|
||||||
|
@ -590,8 +593,12 @@ void LocationBar::hideProgress()
|
||||||
|
|
||||||
void LocationBar::paintEvent(QPaintEvent* event)
|
void LocationBar::paintEvent(QPaintEvent* event)
|
||||||
{
|
{
|
||||||
if (hasFocus() || text().isEmpty()) {
|
if (hasFocus() || text().isEmpty() || m_forceLineEditPaintEvent) {
|
||||||
LineEdit::paintEvent(event);
|
LineEdit::paintEvent(event);
|
||||||
|
if(m_forceLineEditPaintEvent) {
|
||||||
|
m_forceLineEditPaintEvent = false;
|
||||||
|
update();
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,8 @@ private:
|
||||||
bool m_progressVisible;
|
bool m_progressVisible;
|
||||||
ProgressStyle m_progressStyle;
|
ProgressStyle m_progressStyle;
|
||||||
QColor m_progressColor;
|
QColor m_progressColor;
|
||||||
|
|
||||||
|
bool m_forceLineEditPaintEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LOCATIONBAR_H
|
#endif // LOCATIONBAR_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user