summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-07-30 01:59:18 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-07-30 01:59:18 (GMT)
commit2ef98c315b4f0d92ef81f8452eef4c9f55f5eb08 (patch)
treead3b99522395582be747bf5f254f790b22ff97cf
parent926f4dec5d8b55308799e016cb99a1e481a49f3c (diff)
parentab625efe61c4bd4c59064648d75da6d46acdc762 (diff)
downloadQt-2ef98c315b4f0d92ef81f8452eef4c9f55f5eb08.zip
Qt-2ef98c315b4f0d92ef81f8452eef4c9f55f5eb08.tar.gz
Qt-2ef98c315b4f0d92ef81f8452eef4c9f55f5eb08.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--doc/src/images/declarative-transformorigin.pngbin17468 -> 8927 bytes
-rw-r--r--src/declarative/extra/qfxflowview.cpp1
-rw-r--r--src/declarative/extra/qfxparticles.cpp6
-rw-r--r--src/declarative/fx/qfxflickable.cpp2
-rw-r--r--src/declarative/fx/qfximage.cpp6
-rw-r--r--src/declarative/fx/qfxitem.cpp75
-rw-r--r--src/declarative/fx/qfxitem.h30
-rw-r--r--src/declarative/fx/qfxitem_p.h8
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp6
-rw-r--r--src/declarative/fx/qfxlineedit.cpp4
-rw-r--r--src/declarative/fx/qfxmouseregion_p.h2
-rw-r--r--src/declarative/fx/qfxpathview_p.h2
-rw-r--r--src/declarative/fx/qfxrect.cpp12
-rw-r--r--src/declarative/fx/qfxrect.h5
-rw-r--r--src/declarative/fx/qfxrect_p.h16
-rw-r--r--src/declarative/fx/qfxtext.cpp4
-rw-r--r--src/declarative/fx/qfxtextedit.cpp4
-rw-r--r--src/declarative/fx/qfxwebview.cpp2
18 files changed, 62 insertions, 123 deletions
diff --git a/doc/src/images/declarative-transformorigin.png b/doc/src/images/declarative-transformorigin.png
index fbb3b9b..4af320f 100644
--- a/doc/src/images/declarative-transformorigin.png
+++ b/doc/src/images/declarative-transformorigin.png
Binary files differ
diff --git a/src/declarative/extra/qfxflowview.cpp b/src/declarative/extra/qfxflowview.cpp
index 1757c5a..e9b836d 100644
--- a/src/declarative/extra/qfxflowview.cpp
+++ b/src/declarative/extra/qfxflowview.cpp
@@ -71,7 +71,6 @@ QFxFlowView::QFxFlowView()
: m_columns(0), m_model(0), m_vertical(false), m_dragItem(0), m_dragIdx(-1)
{
setAcceptedMouseButtons(Qt::LeftButton);
- setOptions(MouseEvents);
}
QFxVisualItemModel *QFxFlowView::model() const
diff --git a/src/declarative/extra/qfxparticles.cpp b/src/declarative/extra/qfxparticles.cpp
index 13c14b0..0f22165 100644
--- a/src/declarative/extra/qfxparticles.cpp
+++ b/src/declarative/extra/qfxparticles.cpp
@@ -343,7 +343,7 @@ public:
QFxParticlesPainter(QFxParticlesPrivate *p, QFxItem* parent)
: QFxItem(parent), d(p)
{
- setOptions(HasContents);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
maxX = minX = maxY = minY = 0;
}
@@ -600,7 +600,7 @@ QFxParticles::QFxParticles(QFxItem *parent)
{
Q_D(QFxParticles);
d->init();
- setOptions(HasContents);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent)
@@ -608,7 +608,7 @@ QFxParticles::QFxParticles(QFxParticlesPrivate &dd, QFxItem *parent)
{
Q_D(QFxParticles);
d->init();
- setOptions(HasContents);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QFxParticles::~QFxParticles()
diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp
index e73c8a4..bd0c1be 100644
--- a/src/declarative/fx/qfxflickable.cpp
+++ b/src/declarative/fx/qfxflickable.cpp
@@ -111,7 +111,7 @@ void QFxFlickablePrivate::init()
QObject::connect(&_tl, SIGNAL(updated()), q, SLOT(ticked()));
QObject::connect(&_tl, SIGNAL(completed()), q, SLOT(movementEnding()));
q->setAcceptedMouseButtons(Qt::LeftButton);
- q->setOptions(QFxItem::ChildMouseFilter | QFxItem::MouseEvents);
+ q->setOptions(QFxItem::ChildMouseFilter);
QObject::connect(_flick, SIGNAL(xChanged()), q, SIGNAL(positionChanged()));
QObject::connect(_flick, SIGNAL(yChanged()), q, SIGNAL(positionChanged()));
QObject::connect(&elasticX, SIGNAL(updated()), q, SLOT(ticked()));
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index e54dd9b..f1be4a4 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -113,13 +113,13 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage)
QFxImage::QFxImage(QFxItem *parent)
: QFxItem(*(new QFxImagePrivate), parent)
{
- setOptions(SimpleItem | HasContents, true);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QFxImage::QFxImage(QFxImagePrivate &dd, QFxItem *parent)
: QFxItem(dd, parent)
{
- setOptions(SimpleItem | HasContents, true);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QFxImage::~QFxImage()
@@ -561,7 +561,6 @@ void QFxImage::requestFinished()
d->status = Error;
}
d->pix = QFxPixmap(d->url);
- setOptions(QFxImage::SimpleItem, true);
}
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());
@@ -612,7 +611,6 @@ void QFxImage::setGridScaledImage(const QFxGridScaledImage& sci)
sg->setBottom(sci.gridBottom());
sg->setLeft(sci.gridLeft());
sg->setRight(sci.gridRight());
- setOptions(QFxImage::SimpleItem, false);
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
d->reply = QFxPixmap::get(qmlEngine(this), d->sciurl, this, SLOT(requestFinished()));
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 4e66f55..7eaaf8e 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -795,7 +795,7 @@ void QFxItem::setQml(const QUrl &qml)
return;
if (!d->_qml.isEmpty()) {
- QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml.toString());
+ QHash<QString, QFxItem *>::Iterator iter = d->_qmlChildren.find(d->_qml.toString());
if (iter != d->_qmlChildren.end())
(*iter)->setOpacity(0.);
}
@@ -808,7 +808,7 @@ void QFxItem::setQml(const QUrl &qml)
return;
}
- QmlChildren::Iterator iter = d->_qmlChildren.find(d->_qml.toString());
+ QHash<QString, QFxItem *>::Iterator iter = d->_qmlChildren.find(d->_qml.toString());
if (iter != d->_qmlChildren.end()) {
(*iter)->setOpacity(1.);
d->qmlItem = (*iter);
@@ -1689,31 +1689,6 @@ QmlList<QGraphicsTransform *>* QFxItem::transform()
}
/*!
- Creates a new child of the given component \a type. The
- newChildCreated() signal will be emitted when and if the child is
- successfully created.
-
- \preliminary
-*/
-void QFxItem::newChild(const QString &type)
-{
- Q_D(QFxItem);
-
- QUrl url = qmlContext(this)->resolvedUrl(QUrl(type));
- if (url.isEmpty())
- return;
-
- d->_qmlnewloading.append(url);
- d->_qmlnewcomp.append(new QmlComponent(qmlEngine(this), url, this));
-
- if (!d->_qmlnewcomp.last()->isLoading())
- qmlLoaded();
- else
- connect(d->_qmlnewcomp.last(), SIGNAL(statusChanged(QmlComponent::Status)),
- this, SLOT(qmlLoaded()));
-}
-
-/*!
classBegin() is called when the item is constructed, but its
properties have not yet been set.
@@ -1793,19 +1768,19 @@ QPointF QFxItemPrivate::computeTransformOrigin() const
default:
case QFxItem::TopLeft:
return QPointF(0, 0);
- case QFxItem::TopCenter:
+ case QFxItem::Top:
return QPointF(br.width() / 2., 0);
case QFxItem::TopRight:
return QPointF(br.width(), 0);
- case QFxItem::MiddleLeft:
+ case QFxItem::Left:
return QPointF(0, br.height() / 2.);
case QFxItem::Center:
return QPointF(br.width() / 2., br.height() / 2.);
- case QFxItem::MiddleRight:
+ case QFxItem::Right:
return QPointF(br.width(), br.height() / 2.);
case QFxItem::BottomLeft:
return QPointF(0, br.height());
- case QFxItem::BottomCenter:
+ case QFxItem::Bottom:
return QPointF(br.width() / 2., br.height());
case QFxItem::BottomRight:
return QPointF(br.width(), br.height());
@@ -1861,19 +1836,10 @@ void QFxItem::childrenChanged()
{
}
-void QFxItem::setPaintMargin(qreal margin)
-{
- Q_D(QFxItem);
- if (margin == d->paintmargin)
- return;
- prepareGeometryChange();
- d->paintmargin = margin;
-}
-
QRectF QFxItem::boundingRect() const
{
Q_D(const QFxItem);
- return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2);
+ return QRectF(0, 0, d->width, d->height);
}
void QFxItem::paintContents(QPainter &)
@@ -1891,13 +1857,13 @@ void QFxItem::parentChanged(QFxItem *, QFxItem *)
Controls the point about which simple transforms like scale apply.
\value TopLeft The top-left corner of the item.
- \value TopCenter The center point of the top of the item.
+ \value Top The center point of the top of the item.
\value TopRight The top-right corner of the item.
- \value MiddleLeft The left most point of the vertical middle.
+ \value Left The left most point of the vertical middle.
\value Center The center of the item.
- \value MiddleRight The right most point of the vertical middle.
+ \value Right The right most point of the vertical middle.
\value BottomLeft The bottom-left corner of the item.
- \value BottomCenter The center point of the bottom of the item.
+ \value Bottom The center point of the bottom of the item.
\value BottomRight The bottom-right corner of the item.
*/
@@ -2085,16 +2051,6 @@ bool QFxItem::hasActiveFocus() const
return QGraphicsItem::hasFocus();
}
-bool QFxItem::activeFocusPanel() const
-{
- return false;
-}
-
-void QFxItem::setActiveFocusPanel(bool b)
-{
- Q_UNUSED(b)
-}
-
bool QFxItem::sceneEventFilter(QGraphicsItem *w, QEvent *e)
{
switch(e->type()) {
@@ -2129,16 +2085,7 @@ void QFxItem::setOptions(Options options, bool set)
else
d->options &= ~options;
- if ((d->options & IsFocusPanel) && (d->options & IsFocusRealm)) {
- qWarning("QFxItem::setOptions: Cannot set both IsFocusPanel and IsFocusRealm. IsFocusRealm will be unset.");
- d->options &= ~IsFocusRealm;
- }
-
- setFlag(QGraphicsItem::ItemHasNoContents, !(d->options & HasContents));
setFiltersChildEvents(d->options & ChildMouseFilter);
- setFlag(QGraphicsItem::ItemAcceptsInputMethod, (d->options & AcceptsInputMethods));
- setAcceptHoverEvents(d->options & HoverEvents);
-
setFlag(QGraphicsItem::ItemAutoDetectsFocusProxy, d->options & IsFocusRealm);
if ((old & MouseFilter) != (d->options & MouseFilter)) {
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index cd346a7..932d44c 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -124,10 +124,10 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_INTERFACES(QmlParserStatus)
Q_PROPERTY(QFxItem * parent READ parentItem WRITE setParentItem NOTIFY parentChanged DESIGNABLE false FINAL)
+ Q_PROPERTY(QmlList<QObject *> *data READ data DESIGNABLE false)
Q_PROPERTY(QmlList<QFxItem *>* children READ children DESIGNABLE false)
Q_PROPERTY(QmlList<QObject *>* resources READ resources DESIGNABLE false)
Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL)
- Q_PROPERTY(QmlList<QObject *> *data READ data DESIGNABLE false)
Q_PROPERTY(QFxContents * contents READ contents DESIGNABLE false CONSTANT FINAL)
Q_PROPERTY(QmlList<QmlState *>* states READ states DESIGNABLE false)
Q_PROPERTY(QmlList<QmlTransition *>* transitions READ transitions DESIGNABLE false)
@@ -147,30 +147,22 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta
Q_PROPERTY(bool clip READ clip WRITE setClip) // ### move to QGI/QGO, NOTIFY
Q_PROPERTY(bool focus READ hasFocus WRITE setFocus NOTIFY focusChanged FINAL)
Q_PROPERTY(bool activeFocus READ hasActiveFocus NOTIFY activeFocusChanged FINAL)
- Q_PROPERTY(QmlList<QGraphicsTransform *>* transform READ transform DESIGNABLE false FINAL) // ## QGI/QGO
- Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin) // ### move to QGI
+ Q_PROPERTY(QmlList<QGraphicsTransform *>* transform READ transform DESIGNABLE false FINAL)
+ Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin)
Q_ENUMS(TransformOrigin)
Q_CLASSINFO("DefaultProperty", "data")
- typedef QHash<QString, QFxItem *> QmlChildren; // ###
-
public:
enum Option { NoOption = 0x00000000,
MouseFilter = 0x00000001,
ChildMouseFilter = 0x00000002,
- HoverEvents = 0x00000004,
- MouseEvents = 0x00000008,
- HasContents = 0x00000010,
- SimpleItem = 0x00000020,
- IsFocusPanel = 0x00000040,
- IsFocusRealm = 0x00000080,
- AcceptsInputMethods = 0x00000100 };
+ IsFocusRealm = 0x00000080 };
Q_DECLARE_FLAGS(Options, Option)
enum TransformOrigin {
- TopLeft, TopCenter, TopRight,
- MiddleLeft, Center, MiddleRight,
- BottomLeft, BottomCenter, BottomRight
+ TopLeft, Top, TopRight,
+ Left, Center, Right,
+ BottomLeft, Bottom, BottomRight
};
QFxItem(QFxItem *parent = 0);
@@ -185,7 +177,6 @@ public:
QmlList<QObject *> *resources();
QFxAnchors *anchors();
-
QFxContents *contents();
bool clip() const;
@@ -226,7 +217,6 @@ public:
TransformOrigin transformOrigin() const;
void setTransformOrigin(TransformOrigin);
- void setPaintMargin(qreal margin);
QRectF boundingRect() const;
virtual void paintContents(QPainter &);
@@ -234,16 +224,10 @@ public:
virtual bool hasFocus() const;
void setFocus(bool);
- bool activeFocusPanel() const;
- void setActiveFocusPanel(bool);
-
bool hasActiveFocus() const;
QVariant inputMethodQuery(Qt::InputMethodQuery query) const; //### for KeyProxy
-public Q_SLOTS:
- void newChild(const QString &url);
-
Q_SIGNALS:
void xChanged();
void yChanged();
diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h
index 77d0673..a013897 100644
--- a/src/declarative/fx/qfxitem_p.h
+++ b/src/declarative/fx/qfxitem_p.h
@@ -71,8 +71,6 @@ class QFxItemPrivate : public QGraphicsItemPrivate
{
Q_DECLARE_PUBLIC(QFxItem)
- typedef QHash<QString, QFxItem *> QmlChildren;
-
public:
QFxItemPrivate()
: _anchors(0), _contents(0), qmlItem(0), _qmlcomp(0),
@@ -81,8 +79,7 @@ public:
_anchorLines(0),
_stateGroup(0), canvas(0), origin(QFxItem::TopLeft),
options(QFxItem::NoOption),
- widthValid(false), heightValid(false), width(0), height(0),
- paintmargin(0)
+ widthValid(false), heightValid(false), width(0), height(0)
{}
~QFxItemPrivate()
{ delete _anchors; }
@@ -163,7 +160,7 @@ public:
bool _componentComplete:1;
bool _keepMouse:1;
- QmlChildren _qmlChildren;
+ QHash<QString, QFxItem *> _qmlChildren;
struct AnchorLines {
AnchorLines(QFxItem *);
@@ -196,7 +193,6 @@ public:
qreal width;
qreal height;
- qreal paintmargin;
QPointF computeTransformOrigin() const;
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index 13f4bfb..0a9a151 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -96,7 +96,7 @@ public:
QFxKeyProxy::QFxKeyProxy(QFxItem *parent)
: QFxItem(parent), d(new QFxKeyProxyPrivate)
{
- setOptions(AcceptsInputMethods);
+ setFlag(QGraphicsItem::ItemAcceptsInputMethod);
}
QFxKeyProxy::~QFxKeyProxy()
@@ -166,7 +166,7 @@ void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e)
d->inIM = true;
for (int ii = 0; ii < d->targets.count(); ++ii) {
QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
- if (i && (i->options() & AcceptsInputMethods)) {
+ if (i && (i->flags() & ItemAcceptsInputMethod)) {
scene()->sendEvent(i, e);
if (e->isAccepted()) {
d->imeItem = i;
@@ -183,7 +183,7 @@ QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const
{
for (int ii = 0; ii < d->targets.count(); ++ii) {
QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
- if (i && (i->options() & AcceptsInputMethods) && i == d->imeItem) { //### how robust is i == d->imeItem check?
+ if (i && (i->flags() & ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check?
QVariant v = i->inputMethodQuery(query);
if (v.type() == QVariant::RectF)
v = mapRectFromItem(i, v.toRectF()); //### cost?
diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxlineedit.cpp
index a185383..bef77e7 100644
--- a/src/declarative/fx/qfxlineedit.cpp
+++ b/src/declarative/fx/qfxlineedit.cpp
@@ -475,8 +475,8 @@ void QFxLineEditPrivate::init()
control->setLayoutDirection(Qt::LeftToRight);
q->setSmooth(true);
q->setAcceptedMouseButtons(Qt::LeftButton);
- q->setOptions(QFxLineEdit::AcceptsInputMethods | QFxLineEdit::SimpleItem
- | QFxLineEdit::HasContents | QFxLineEdit::MouseEvents);
+ q->setFlag(QGraphicsItem::ItemHasNoContents, false);
+ q->setFlag(QGraphicsItem::ItemAcceptsInputMethod);
q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(cursorPosChanged()));
q->connect(control, SIGNAL(selectionChanged()),
diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h
index 70d78f3..f03c334 100644
--- a/src/declarative/fx/qfxmouseregion_p.h
+++ b/src/declarative/fx/qfxmouseregion_p.h
@@ -74,7 +74,7 @@ public:
{
Q_Q(QFxMouseRegion);
q->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton);
- q->setOptions(QFxItem::HoverEvents | QFxItem::MouseEvents);
+ q->setAcceptHoverEvents(true);
}
void saveEvent(QGraphicsSceneMouseEvent *event) {
diff --git a/src/declarative/fx/qfxpathview_p.h b/src/declarative/fx/qfxpathview_p.h
index be9509f..eeccc87 100644
--- a/src/declarative/fx/qfxpathview_p.h
+++ b/src/declarative/fx/qfxpathview_p.h
@@ -87,7 +87,7 @@ public:
Q_Q(QFxPathView);
_offset = 0;
q->setAcceptedMouseButtons(Qt::NoButton);
- q->setOptions(QFxItem::ChildMouseFilter | QFxItem::MouseEvents | QFxItem::IsFocusRealm);
+ q->setOptions(QFxItem::ChildMouseFilter | QFxItem::IsFocusRealm);
q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked()));
}
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index 7010ba1..c43e034 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -239,7 +239,7 @@ QFxRect::QFxRect(QFxItem *parent)
{
Q_D(QFxRect);
d->init();
- setOptions(HasContents, true);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QFxRect::QFxRect(QFxRectPrivate &dd, QFxItem *parent)
@@ -247,7 +247,7 @@ QFxRect::QFxRect(QFxRectPrivate &dd, QFxItem *parent)
{
Q_D(QFxRect);
d->init();
- setOptions(HasContents, true);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
void QFxRect::doUpdate()
@@ -255,7 +255,7 @@ void QFxRect::doUpdate()
Q_D(QFxRect);
d->rectImage = QPixmap();
const int pw = d->pen && d->pen->isValid() ? d->pen->width() : 0;
- setPaintMargin((pw+1)/2);
+ d->setPaintMargin((pw+1)/2);
update();
}
@@ -605,4 +605,10 @@ void QFxRect::drawRect(QPainter &p)
}
}
+QRectF QFxRect::boundingRect() const
+{
+ Q_D(const QFxRect);
+ return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2);
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h
index 7790af1..d438459 100644
--- a/src/declarative/fx/qfxrect.h
+++ b/src/declarative/fx/qfxrect.h
@@ -157,6 +157,8 @@ public:
qreal radius() const;
void setRadius(qreal radius);
+ QRectF boundingRect() const;
+
void paintContents(QPainter &painter);
private Q_SLOTS:
@@ -165,9 +167,8 @@ private Q_SLOTS:
private:
void generateRoundedRect();
void generateBorderedRect();
-#if defined(QFX_RENDER_QPAINTER)
void drawRect(QPainter &painter);
-#endif
+
protected:
QFxRect(QFxRectPrivate &dd, QFxItem *parent);
diff --git a/src/declarative/fx/qfxrect_p.h b/src/declarative/fx/qfxrect_p.h
index 3544d36..25fa38d 100644
--- a/src/declarative/fx/qfxrect_p.h
+++ b/src/declarative/fx/qfxrect_p.h
@@ -58,14 +58,14 @@
QT_BEGIN_NAMESPACE
class QFxGradient;
-
+class QFxRect;
class QFxRectPrivate : public QFxItemPrivate
{
Q_DECLARE_PUBLIC(QFxRect)
public:
QFxRectPrivate() :
- color(Qt::white), gradient(0), pen(0), radius(0)
+ color(Qt::white), gradient(0), pen(0), radius(0), paintmargin(0)
{
}
@@ -92,9 +92,17 @@ public:
}
QFxPen *pen;
qreal radius;
-#if defined(QFX_RENDER_QPAINTER)
+ qreal paintmargin;
QPixmap rectImage;
-#endif
+
+ void setPaintMargin(qreal margin)
+ {
+ Q_Q(QFxRect);
+ if (margin == paintmargin)
+ return;
+ q->prepareGeometryChange();
+ paintmargin = margin;
+ }
};
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index e0692e9..cb8af40 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -110,7 +110,7 @@ QFxText::QFxText(QFxItem *parent)
Q_D(QFxText);
d->init();
setAcceptedMouseButtons(Qt::LeftButton);
- setOptions(SimpleItem | HasContents | QFxText::MouseEvents);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QFxText::QFxText(QFxTextPrivate &dd, QFxItem *parent)
@@ -119,7 +119,7 @@ QFxText::QFxText(QFxTextPrivate &dd, QFxItem *parent)
Q_D(QFxText);
d->init();
setAcceptedMouseButtons(Qt::LeftButton);
- setOptions(SimpleItem | HasContents | QFxText::MouseEvents);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
}
QFxText::~QFxText()
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index abad7fc..b632268 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -1016,8 +1016,8 @@ void QFxTextEditPrivate::init()
q->setSmooth(true);
q->setAcceptedMouseButtons(Qt::LeftButton);
- q->setOptions(QFxTextEdit::AcceptsInputMethods | QFxTextEdit::SimpleItem
- | QFxTextEdit::HasContents | QFxTextEdit::MouseEvents);
+ q->setFlag(QGraphicsItem::ItemHasNoContents, false);
+ q->setFlag(QGraphicsItem::ItemAcceptsInputMethod);
QObject::connect(&font, SIGNAL(updated()), q, SLOT(fontChanged()));
diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp
index 83f9249..75cb624 100644
--- a/src/declarative/fx/qfxwebview.cpp
+++ b/src/declarative/fx/qfxwebview.cpp
@@ -236,7 +236,7 @@ void QFxWebView::init()
Q_D(QFxWebView);
setAcceptedMouseButtons(Qt::LeftButton);
- setOptions(HasContents | MouseEvents);
+ setFlag(QGraphicsItem::ItemHasNoContents, false);
d->page = 0;
}