diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2009-09-15 23:43:45 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2009-09-15 23:43:45 (GMT) |
commit | adfb5c6160b37a917f20b301366567c208ae52a0 (patch) | |
tree | c74ef9bb4b0fa56ab44b8ce7ff4762da886ac725 /src | |
parent | d94f6a35202d2d62671072b4ba78e75b07d630bd (diff) | |
download | Qt-adfb5c6160b37a917f20b301366567c208ae52a0.zip Qt-adfb5c6160b37a917f20b301366567c208ae52a0.tar.gz Qt-adfb5c6160b37a917f20b301366567c208ae52a0.tar.bz2 |
Fix QLineEdit::setPalette
QLineControl has a separate palette that wasn't getting updated.
Task-number: 261239
Reviewed-by: mbm
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qlinecontrol_p.h | 13 | ||||
-rw-r--r-- | src/gui/widgets/qlineedit.cpp | 6 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/gui/widgets/qlinecontrol_p.h b/src/gui/widgets/qlinecontrol_p.h index 8ad0452..68898b6 100644 --- a/src/gui/widgets/qlinecontrol_p.h +++ b/src/gui/widgets/qlinecontrol_p.h @@ -220,6 +220,9 @@ public: QString cancelText() const; void setCancelText(const QString &text); + const QPalette &palette() const; + void setPalette(const QPalette &); + enum DrawFlags { DrawText = 0x01, DrawSelections = 0x02, @@ -741,6 +744,16 @@ inline void QLineControl::setCancelText(const QString &text) m_cancelText = text; } +inline const QPalette & QLineControl::palette() const +{ + return m_palette; +} + +inline void QLineControl::setPalette(const QPalette &p) +{ + m_palette = p; +} + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index a55ca8e..b4cea1b 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1851,8 +1851,12 @@ void QLineEdit::paintEvent(QPaintEvent *) #ifdef QT_KEYPAD_NAVIGATION if (!QApplication::keypadNavigationEnabled() || hasEditFocus()) #endif - if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())) + if (d->control->hasSelectedText() || (d->cursorVisible && !d->control->inputMask().isEmpty() && !d->control->isReadOnly())){ flags |= QLineControl::DrawSelections; + // Palette only used for selections/mask and may not be in sync + if(d->control->palette() != pal) + d->control->setPalette(pal); + } // Asian users see an IM selection text as cursor on candidate // selection phase of input method, so the ordinary cursor should be |