summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/fx/qfxpainteditem.cpp8
-rw-r--r--src/declarative/fx/qfxtextedit.cpp30
-rw-r--r--src/declarative/fx/qfxtextedit.h4
-rw-r--r--src/declarative/fx/qfxtextedit_p.h1
4 files changed, 38 insertions, 5 deletions
diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp
index 950b468..4d2e327 100644
--- a/src/declarative/fx/qfxpainteditem.cpp
+++ b/src/declarative/fx/qfxpainteditem.cpp
@@ -252,9 +252,7 @@ void QFxPaintedItem::paintGLContents(GLPainter &p)
const QRectF clipf = p.sceneClipRect;
#endif
- qreal hscale = widthValid() ? qreal(width()) / content.width() : heightValid() ? qreal(height()) / content.height() : 1.0;
- qreal vscale = heightValid() ? qreal(height()) / content.height() : widthValid() ? qreal(width()) / content.width() : 1.0;
- const QRect clip = mapFromScene(QRectF(clipf.x()/hscale,clipf.y()/vscale,clipf.width()/hscale,clipf.height()/vscale)).toRect();
+ const QRect clip = mapFromScene(clipf).toRect();
QRegion topaint(clip);
topaint &= content;
@@ -272,7 +270,7 @@ void QFxPaintedItem::paintGLContents(GLPainter &p)
for (int i=0; i<d->imagecache.count(); ++i) {
QRect area = d->imagecache[i]->area;
if (topaint.contains(area)) {
- QRectF target(area.x()*hscale, area.y()*vscale, area.width()*hscale, area.height()*vscale);
+ QRectF target(area.x(), area.y(), area.width(), area.height());
p.drawImage(target.toRect(), d->imagecache[i]->image);
topaint -= area;
d->imagecache[i]->age=0;
@@ -324,7 +322,7 @@ void QFxPaintedItem::paintGLContents(GLPainter &p)
newitem->image.setImage(img);
#endif
d->imagecache.append(newitem);
- QRectF target(r.x()*hscale, r.y()*vscale, r.width()*hscale, r.height()*vscale);
+ QRectF target(r.x(), r.y(), r.width(), r.height());
p.drawImage(target.toRect(), newitem->image);
}
}
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;