From beab75abef7dfb221418ca3b3e04e918f175d32f Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Fri, 8 May 2009 13:09:56 +1000 Subject: highlight color property --- src/declarative/fx/qfxtextedit.cpp | 30 ++++++++++++++++++++++++++++++ src/declarative/fx/qfxtextedit.h | 4 ++++ src/declarative/fx/qfxtextedit_p.h | 1 + 3 files changed, 35 insertions(+) diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 3bc9696..fb46a0e 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -292,6 +292,36 @@ void QFxTextEdit::setColor(const QColor &color) } /*! + \qmlproperty color TextEdit::highlightColor + + The text highlight color, used behind selections. +*/ + +/*! + \property QFxTextEdit::highlightColor + \brief the text edit's default text highlight color +*/ +QColor QFxTextEdit::highlightColor() const +{ + Q_D(const QFxTextEdit); + return d->highlightColor; +} + +void QFxTextEdit::setHighlightColor(const QColor &color) +{ + Q_D(QFxTextEdit); + if (d->highlightColor == color) + return; + + clearCache(); + d->highlightColor = color; + QPalette pal = d->control->palette(); + pal.setColor(QPalette::Highlight, color); + d->control->setPalette(pal); + update(); +} + +/*! \qmlproperty enumeration TextEdit::hAlign \qmlproperty enumeration TextEdit::vAlign diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index 068a25a..5d95cd1 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -69,6 +69,7 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor color READ color WRITE setColor) + Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) Q_PROPERTY(QmlFont * font READ font) Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) @@ -111,6 +112,9 @@ public: QColor color() const; void setColor(const QColor &c); + QColor highlightColor() const; + void setHighlightColor(const QColor &c); + HAlignment hAlign() const; void setHAlign(HAlignment align); diff --git a/src/declarative/fx/qfxtextedit_p.h b/src/declarative/fx/qfxtextedit_p.h index f4591f5..dd2a1bf 100644 --- a/src/declarative/fx/qfxtextedit_p.h +++ b/src/declarative/fx/qfxtextedit_p.h @@ -80,6 +80,7 @@ public: QString text; QmlFont font; QColor color; + QColor highlightColor; QString style; QColor styleColor; bool imgDirty; -- cgit v0.12