summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/gui/widgets/qlinecontrol_p.h13
-rw-r--r--src/gui/widgets/qlineedit.cpp7
2 files changed, 18 insertions, 2 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 37e57cf..629e839 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1434,7 +1434,6 @@ void QLineEdit::mousePressEvent(QMouseEvent* e)
#ifndef QT_NO_DRAGANDDROP
if (!mark && d->dragEnabled && d->control->echoMode() == Normal &&
e->button() == Qt::LeftButton && d->control->inSelection(e->pos().x())) {
- d->control->moveCursor(cursor);
d->dndPos = e->pos();
if (!d->dndTimer.isActive())
d->dndTimer.start(QApplication::startDragTime(), this);
@@ -1851,8 +1850,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