summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-06-24 04:27:32 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-06-24 04:27:32 (GMT)
commita35490462c978f4659f0e20df2fe5438a603891e (patch)
treea52eb8a28c380e00de89079305bb95e70e8eac32 /src/declarative
parent87a6f615b698451111ba62b8b1763944bbfcf578 (diff)
parent1a2f2b52ec8929a83210aadf0c169a917e6005b1 (diff)
downloadQt-a35490462c978f4659f0e20df2fe5438a603891e.zip
Qt-a35490462c978f4659f0e20df2fe5438a603891e.tar.gz
Qt-a35490462c978f4659f0e20df2fe5438a603891e.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxpainteditem.cpp30
-rw-r--r--src/declarative/fx/qfxpainteditem.h7
-rw-r--r--src/declarative/fx/qfxpainteditem_p.h3
-rw-r--r--src/declarative/fx/qfxwebview.cpp7
-rw-r--r--src/declarative/fx/qfxwebview.h1
5 files changed, 37 insertions, 11 deletions
diff --git a/src/declarative/fx/qfxpainteditem.cpp b/src/declarative/fx/qfxpainteditem.cpp
index 29d11ff..65589f2 100644
--- a/src/declarative/fx/qfxpainteditem.cpp
+++ b/src/declarative/fx/qfxpainteditem.cpp
@@ -156,7 +156,6 @@ void QFxPaintedItem::setSmooth(bool smooth)
Q_D(QFxPaintedItem);
if (d->smooth == smooth) return;
d->smooth = smooth;
- clearCache();
update();
}
@@ -304,7 +303,8 @@ void QFxPaintedItem::paintGLContents(GLPainter &p)
for (int i = 0; i < rects.count(); ++i) {
const QRect &r = rects.at(i);
QPixmap img(r.size());
- img.fill(Qt::transparent);
+ if (d->fillColor.isValid())
+ img.fill(d->fillColor);
{
QPainter qp(&img);
qp.translate(-r.x(),-r.y());
@@ -384,4 +384,30 @@ void QFxPaintedItem::setCacheSize(int pixels)
d->max_imagecache_size = pixels;
}
+/*!
+ \property QFxPaintedItem::fillColor
+
+ The color to be used to fill the item prior to calling drawContents().
+ By default, this is Qt::transparent.
+
+ Performance improvements can be achieved if subclasses call this with either an
+ invalid color (QColor()), or an appropriate solid color.
+*/
+void QFxPaintedItem::setFillColor(const QColor& c)
+{
+ Q_D(QFxPaintedItem);
+ if (d->fillColor == c)
+ return;
+ d->fillColor = c;
+ emit fillColorChanged();
+ update();
+}
+
+QColor QFxPaintedItem::fillColor() const
+{
+ Q_D(const QFxPaintedItem);
+ return d->fillColor;
+}
+
+
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxpainteditem.h b/src/declarative/fx/qfxpainteditem.h
index b7db2d9..6cb8fe7 100644
--- a/src/declarative/fx/qfxpainteditem.h
+++ b/src/declarative/fx/qfxpainteditem.h
@@ -59,6 +59,7 @@ class Q_DECLARATIVE_EXPORT QFxPaintedItem : public QFxItem
Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize)
Q_PROPERTY(bool smooth READ isSmooth WRITE setSmooth)
+ Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
Q_PROPERTY(int cacheSize READ cacheSize WRITE setCacheSize)
public:
@@ -80,11 +81,17 @@ public:
int cacheSize() const;
void setCacheSize(int pixels);
+ QColor fillColor() const;
+ void setFillColor(const QColor&);
+
protected:
QFxPaintedItem(QFxPaintedItemPrivate &dd, QFxItem *parent);
virtual void drawContents(QPainter *p, const QRect &) = 0;
+Q_SIGNALS:
+ void fillColorChanged();
+
protected Q_SLOTS:
void dirtyCache(const QRect &);
void clearCache();
diff --git a/src/declarative/fx/qfxpainteditem_p.h b/src/declarative/fx/qfxpainteditem_p.h
index 21ac556..4e953a0 100644
--- a/src/declarative/fx/qfxpainteditem_p.h
+++ b/src/declarative/fx/qfxpainteditem_p.h
@@ -68,7 +68,7 @@ class QFxPaintedItemPrivate : public QFxItemPrivate
public:
QFxPaintedItemPrivate()
- : max_imagecache_size(100000), smooth(false)
+ : max_imagecache_size(100000), smooth(false), fillColor(Qt::transparent)
{
}
@@ -89,6 +89,7 @@ public:
int max_imagecache_size;
bool smooth;
QSize contentsSize;
+ QColor fillColor;
};
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index adb33e8..f4a06ce 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -428,12 +428,6 @@ void QFxWebView::setInteractive(bool i)
emit interactiveChanged();
}
-void QFxWebView::updateCacheForVisibility()
-{
- if (!isVisible())
- clearCache();
-}
-
void QFxWebView::expandToWebPage()
{
Q_D(QFxWebView);
@@ -845,7 +839,6 @@ void QFxWebView::setPage(QWebPage *page)
d->idealheight>0 ? d->idealheight : -1));
d->page->mainFrame()->setScrollBarPolicy(Qt::Horizontal,Qt::ScrollBarAlwaysOff);
d->page->mainFrame()->setScrollBarPolicy(Qt::Vertical,Qt::ScrollBarAlwaysOff);
- connect(this,SIGNAL(visibleChanged()),this,SLOT(updateCacheForVisibility()));
connect(d->page,SIGNAL(repaintRequested(QRect)),this,SLOT(paintPage(QRect)));
connect(d->page->mainFrame(),SIGNAL(urlChanged(QUrl)),this,SIGNAL(urlChanged()));
connect(d->page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString)));
diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h
index c9a62cc..0ac1895 100644
--- a/src/declarative/fx/qfxwebview.h
+++ b/src/declarative/fx/qfxwebview.h
@@ -179,7 +179,6 @@ Q_SIGNALS:
void doubleClick();
private Q_SLOTS:
- void updateCacheForVisibility();
void expandToWebPage();
void paintPage(const QRect&);
void doLoadProgress(int p);