summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-06-22 23:11:24 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-06-22 23:11:24 (GMT)
commit19e9e13420de8bb1996c426ef7af14efdbcbbd6b (patch)
tree6af52c7c32bced3289a3550e63a97ccfc660b794
parent511d86e88b33380116f27d5f6a2a0754e8f62fa0 (diff)
parent93116be19628239b82ba19f814374b2fcabd7c96 (diff)
downloadQt-19e9e13420de8bb1996c426ef7af14efdbcbbd6b.zip
Qt-19e9e13420de8bb1996c426ef7af14efdbcbbd6b.tar.gz
Qt-19e9e13420de8bb1996c426ef7af14efdbcbbd6b.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--doc/src/declarative/elements.qdoc2
-rw-r--r--src/declarative/canvas/qsimplecanvasitem.cpp11
-rw-r--r--src/declarative/canvas/qsimplecanvasitem_p.h6
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp1
-rw-r--r--src/declarative/extra/qmlsqlconnection.h1
-rw-r--r--src/declarative/extra/qmlsqlquery.cpp1
-rw-r--r--src/declarative/extra/qmlsqlquery.h2
-rw-r--r--src/declarative/fx/qfxanchors.cpp124
-rw-r--r--src/declarative/fx/qfxanchors.h3
-rw-r--r--src/declarative/fx/qfxitem.cpp8
-rw-r--r--src/declarative/fx/qfxtext.cpp1
-rw-r--r--src/declarative/fx/qfxtext.h1
-rw-r--r--src/declarative/fx/qfxtextedit.cpp1
-rw-r--r--src/declarative/util/qmlconnection.h1
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp26
15 files changed, 125 insertions, 64 deletions
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 3298699..35d746b 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -35,7 +35,7 @@ The following table lists the Qml elements provided by the Qt Declarative module
\o \l SetPropertyAction
\o \l ParentChangeAction
\o \l Transition
-\o \l Behaviour
+\o \l Behavior
\o \l Follow
\endlist
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp
index cbdc324..0ceb7b7 100644
--- a/src/declarative/canvas/qsimplecanvasitem.cpp
+++ b/src/declarative/canvas/qsimplecanvasitem.cpp
@@ -1027,7 +1027,16 @@ void QSimpleCanvasItem::setTransform(const QSimpleCanvas::Matrix &m)
Q_D(QSimpleCanvasItem);
if (d->graphicsItem) {
d->graphicsItem->transform = QSimpleCanvasConfig::matrixToTransform(m);
- d->graphicsItem->setTransform(QTransform::fromScale(d->scale, d->scale) * d->graphicsItem->transform);
+ QTransform t;
+ if (d->scale != 1) {
+ QPointF to = transformOriginPoint();
+ if (to.x() != 0. || to.y() != 0.)
+ t.translate(to.x(), to.y());
+ t.scale(d->scale, d->scale);
+ if (to.x() != 0. || to.y() != 0.)
+ t.translate(-to.x(), -to.y());
+ }
+ d->graphicsItem->setTransform(t * d->graphicsItem->transform);
} else {
if (!d->data()->transformUser)
d->data()->transformUser = new QSimpleCanvas::Matrix;
diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h
index 6c21d9f..7a8f40a 100644
--- a/src/declarative/canvas/qsimplecanvasitem_p.h
+++ b/src/declarative/canvas/qsimplecanvasitem_p.h
@@ -53,8 +53,8 @@
#include "qgraphicsitem.h"
-
QT_BEGIN_NAMESPACE
+
class QSimpleGraphicsItem : public QGraphicsItem
{
public:
@@ -265,6 +265,6 @@ public:
Q_DECLARE_OPERATORS_FOR_FLAGS(QSimpleCanvasItemPrivate::FocusStateCheckDatas)
Q_DECLARE_OPERATORS_FOR_FLAGS(QSimpleCanvasItemPrivate::FocusStateCheckRDatas)
-#endif // QSIMPLECANVASITEM_P_H
-
QT_END_NAMESPACE
+
+#endif // QSIMPLECANVASITEM_P_H
diff --git a/src/declarative/extra/qmlsqlconnection.cpp b/src/declarative/extra/qmlsqlconnection.cpp
index a329f3c..5cf572b 100644
--- a/src/declarative/extra/qmlsqlconnection.cpp
+++ b/src/declarative/extra/qmlsqlconnection.cpp
@@ -92,7 +92,6 @@ public:
/*!
\qmlproperty QString SqlConnection::name
- \default
Defines the connection's name. The name allows the connection to be
retrieved using the connection property of SqlQuery or when
diff --git a/src/declarative/extra/qmlsqlconnection.h b/src/declarative/extra/qmlsqlconnection.h
index 306db8d..ede8bcb 100644
--- a/src/declarative/extra/qmlsqlconnection.h
+++ b/src/declarative/extra/qmlsqlconnection.h
@@ -67,7 +67,6 @@ class Q_DECLARATIVE_EXPORT QmlSqlConnection : public QObject, public QmlParserSt
Q_PROPERTY(QString userName READ userName WRITE setUserName)
Q_PROPERTY(QString password READ password WRITE setPassword)
Q_PROPERTY(QString lastError READ lastError)
- Q_CLASSINFO("DefaultProperty", "name")
public:
QmlSqlConnection(QObject *parent = 0);
~QmlSqlConnection();
diff --git a/src/declarative/extra/qmlsqlquery.cpp b/src/declarative/extra/qmlsqlquery.cpp
index 82ac50062..2b11774 100644
--- a/src/declarative/extra/qmlsqlquery.cpp
+++ b/src/declarative/extra/qmlsqlquery.cpp
@@ -290,7 +290,6 @@ public:
/*!
\qmlproperty QString SqlQuery::query
- \default
Defines the query text.
*/
diff --git a/src/declarative/extra/qmlsqlquery.h b/src/declarative/extra/qmlsqlquery.h
index 7aa0709..06ade08 100644
--- a/src/declarative/extra/qmlsqlquery.h
+++ b/src/declarative/extra/qmlsqlquery.h
@@ -96,8 +96,6 @@ class Q_DECLARATIVE_EXPORT QmlSqlQuery : public QListModelInterface, public QmlP
Q_PROPERTY(QString lastError READ lastError)
Q_PROPERTY(QmlList<QmlSqlBind *> *bindings READ bindings)
-
- Q_CLASSINFO("DefaultProperty", "query")
public:
QmlSqlQuery(QObject *parent = 0);
~QmlSqlQuery();
diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp
index 09d6178..3da58a2 100644
--- a/src/declarative/fx/qfxanchors.cpp
+++ b/src/declarative/fx/qfxanchors.cpp
@@ -533,12 +533,12 @@ void QFxAnchors::setTop(const QFxAnchorLine &edge)
if (!d->checkVAnchorValid(edge))
return;
- if (edge.item)
- d->usedAnchors |= HasTopAnchor;
- else
- d->usedAnchors &= ~HasTopAnchor;
+ d->usedAnchors |= HasTopAnchor;
- d->checkVValid();
+ if (!d->checkVValid()) {
+ d->usedAnchors &= ~HasTopAnchor;
+ return;
+ }
d->remDepend(d->top.item);
d->top = edge;
@@ -548,7 +548,11 @@ void QFxAnchors::setTop(const QFxAnchorLine &edge)
void QFxAnchors::resetTop()
{
- setTop(QFxAnchorLine());
+ Q_D(QFxAnchors);
+ d->usedAnchors &= ~HasTopAnchor;
+ d->remDepend(d->top.item);
+ d->top = QFxAnchorLine();
+ d->updateVerticalAnchors();
}
QFxAnchorLine QFxAnchors::bottom() const
@@ -563,12 +567,12 @@ void QFxAnchors::setBottom(const QFxAnchorLine &edge)
if (!d->checkVAnchorValid(edge))
return;
- if (edge.item)
- d->usedAnchors |= HasBottomAnchor;
- else
- d->usedAnchors &= ~HasBottomAnchor;
+ d->usedAnchors |= HasBottomAnchor;
- d->checkVValid();
+ if (!d->checkVValid()) {
+ d->usedAnchors &= ~HasBottomAnchor;
+ return;
+ }
d->remDepend(d->bottom.item);
d->bottom = edge;
@@ -578,7 +582,11 @@ void QFxAnchors::setBottom(const QFxAnchorLine &edge)
void QFxAnchors::resetBottom()
{
- setBottom(QFxAnchorLine());
+ Q_D(QFxAnchors);
+ d->usedAnchors &= ~HasBottomAnchor;
+ d->remDepend(d->bottom.item);
+ d->bottom = QFxAnchorLine();
+ d->updateVerticalAnchors();
}
QFxAnchorLine QFxAnchors::verticalCenter() const
@@ -593,12 +601,12 @@ void QFxAnchors::setVerticalCenter(const QFxAnchorLine &edge)
if (!d->checkVAnchorValid(edge))
return;
- if (edge.item)
- d->usedAnchors |= HasVCenterAnchor;
- else
- d->usedAnchors &= ~HasVCenterAnchor;
+ d->usedAnchors |= HasVCenterAnchor;
- d->checkVValid();
+ if (!d->checkVValid()) {
+ d->usedAnchors &= ~HasVCenterAnchor;
+ return;
+ }
d->remDepend(d->vCenter.item);
d->vCenter = edge;
@@ -608,7 +616,11 @@ void QFxAnchors::setVerticalCenter(const QFxAnchorLine &edge)
void QFxAnchors::resetVerticalCenter()
{
- setVerticalCenter(QFxAnchorLine());
+ Q_D(QFxAnchors);
+ d->usedAnchors &= ~HasVCenterAnchor;
+ d->remDepend(d->vCenter.item);
+ d->vCenter = QFxAnchorLine();
+ d->updateVerticalAnchors();
}
QFxAnchorLine QFxAnchors::baseline() const
@@ -623,12 +635,12 @@ void QFxAnchors::setBaseline(const QFxAnchorLine &edge)
if (!d->checkVAnchorValid(edge))
return;
- if (edge.item)
- d->usedAnchors |= HasBaselineAnchor;
- else
- d->usedAnchors &= ~HasBaselineAnchor;
+ d->usedAnchors |= HasBaselineAnchor;
- d->checkVValid();
+ if (!d->checkVValid()) {
+ d->usedAnchors &= ~HasBaselineAnchor;
+ return;
+ }
d->remDepend(d->baseline.item);
d->baseline = edge;
@@ -638,7 +650,11 @@ void QFxAnchors::setBaseline(const QFxAnchorLine &edge)
void QFxAnchors::resetBaseline()
{
- setBaseline(QFxAnchorLine());
+ Q_D(QFxAnchors);
+ d->usedAnchors &= ~HasBaselineAnchor;
+ d->remDepend(d->baseline.item);
+ d->baseline = QFxAnchorLine();
+ d->updateVerticalAnchors();
}
QFxAnchorLine QFxAnchors::left() const
@@ -653,12 +669,12 @@ void QFxAnchors::setLeft(const QFxAnchorLine &edge)
if (!d->checkHAnchorValid(edge))
return;
- if (edge.item)
- d->usedAnchors |= HasLeftAnchor;
- else
- d->usedAnchors &= ~HasLeftAnchor;
+ d->usedAnchors |= HasLeftAnchor;
- d->checkHValid();
+ if (!d->checkHValid()) {
+ d->usedAnchors &= ~HasLeftAnchor;
+ return;
+ }
d->remDepend(d->left.item);
d->left = edge;
@@ -668,7 +684,11 @@ void QFxAnchors::setLeft(const QFxAnchorLine &edge)
void QFxAnchors::resetLeft()
{
- setLeft(QFxAnchorLine());
+ Q_D(QFxAnchors);
+ d->usedAnchors &= ~HasLeftAnchor;
+ d->remDepend(d->left.item);
+ d->left = QFxAnchorLine();
+ d->updateHorizontalAnchors();
}
QFxAnchorLine QFxAnchors::right() const
@@ -683,12 +703,12 @@ void QFxAnchors::setRight(const QFxAnchorLine &edge)
if (!d->checkHAnchorValid(edge))
return;
- if (edge.item)
- d->usedAnchors |= HasRightAnchor;
- else
- d->usedAnchors &= ~HasRightAnchor;
+ d->usedAnchors |= HasRightAnchor;
- d->checkHValid();
+ if (!d->checkHValid()) {
+ d->usedAnchors &= ~HasRightAnchor;
+ return;
+ }
d->remDepend(d->right.item);
d->right = edge;
@@ -699,7 +719,11 @@ void QFxAnchors::setRight(const QFxAnchorLine &edge)
void QFxAnchors::resetRight()
{
- setRight(QFxAnchorLine());
+ Q_D(QFxAnchors);
+ d->usedAnchors &= ~HasRightAnchor;
+ d->remDepend(d->right.item);
+ d->right = QFxAnchorLine();
+ d->updateHorizontalAnchors();
}
QFxAnchorLine QFxAnchors::horizontalCenter() const
@@ -714,12 +738,12 @@ void QFxAnchors::setHorizontalCenter(const QFxAnchorLine &edge)
if (!d->checkHAnchorValid(edge))
return;
- if (edge.item)
- d->usedAnchors |= HasHCenterAnchor;
- else
- d->usedAnchors &= ~HasHCenterAnchor;
+ d->usedAnchors |= HasHCenterAnchor;
- d->checkHValid();
+ if (!d->checkHValid()) {
+ d->usedAnchors &= ~HasHCenterAnchor;
+ return;
+ }
d->remDepend(d->hCenter.item);
d->hCenter = edge;
@@ -729,7 +753,11 @@ void QFxAnchors::setHorizontalCenter(const QFxAnchorLine &edge)
void QFxAnchors::resetHorizontalCenter()
{
- setHorizontalCenter(QFxAnchorLine());
+ Q_D(QFxAnchors);
+ d->usedAnchors &= ~HasHCenterAnchor;
+ d->remDepend(d->hCenter.item);
+ d->hCenter = QFxAnchorLine();
+ d->updateHorizontalAnchors();
}
int QFxAnchors::leftMargin() const
@@ -848,13 +876,16 @@ bool QFxAnchorsPrivate::checkHValid() const
bool QFxAnchorsPrivate::checkHAnchorValid(QFxAnchorLine anchor) const
{
- if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) {
+ if (!anchor.item) {
+ qmlInfo(item) << "Can't anchor to a null item.";
+ return false;
+ } else if (anchor.anchorLine & QFxAnchorLine::Vertical_Mask) {
qmlInfo(item) << "Can't anchor a horizontal edge to a vertical edge.";
return false;
} else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){
qmlInfo(item) << "Can't anchor to an item that isn't a parent or sibling.";
return false;
- } else if (anchor.item == item){
+ } else if (anchor.item == item) {
qmlInfo(item) << "Can't anchor item to self.";
return false;
}
@@ -882,7 +913,10 @@ bool QFxAnchorsPrivate::checkVValid() const
bool QFxAnchorsPrivate::checkVAnchorValid(QFxAnchorLine anchor) const
{
- if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) {
+ if (!anchor.item) {
+ qmlInfo(item) << "Can't anchor to a null item.";
+ return false;
+ } else if (anchor.anchorLine & QFxAnchorLine::Horizontal_Mask) {
qmlInfo(item) << "Can't anchor a vertical edge to a horizontal edge.";
return false;
} else if (anchor.item != item->itemParent() && anchor.item->itemParent() != item->itemParent()){
diff --git a/src/declarative/fx/qfxanchors.h b/src/declarative/fx/qfxanchors.h
index 0e44223..206a05c 100644
--- a/src/declarative/fx/qfxanchors.h
+++ b/src/declarative/fx/qfxanchors.h
@@ -58,11 +58,12 @@ class QFxAnchorsPrivate;
class QFxAnchorLine
{
public:
- QFxAnchorLine() : item(0), anchorLine(Left)
+ QFxAnchorLine() : item(0), anchorLine(Invalid)
{
}
enum AnchorLine {
+ Invalid = 0x0,
Left = 0x01,
Right = 0x02,
Top = 0x04,
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 079d691..0c4d97b 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -1433,7 +1433,7 @@ void QFxItem::setBaselineOffset(int offset)
\qmlproperty real Item::rotation
This property holds the rotation of the item in degrees.
- This specifies how many degrees to rotate the item around its origin (0,0).
+ This specifies how many degrees to rotate the item around its transformOrigin.
The default rotation is 0 degrees (i.e. not rotated at all).
\table
@@ -1468,7 +1468,7 @@ void QFxItem::setBaselineOffset(int offset)
\property QFxItem::rotation
This property holds the rotation of the item in degrees.
- This specifies how many degrees to rotate the item around its origin (0,0).
+ This specifies how many degrees to rotate the item around its transformOrigin.
The default rotation is 0 degrees (i.e. not rotated at all).
*/
qreal QFxItem::rotation() const
@@ -1511,7 +1511,7 @@ void QFxItem::setRotation(qreal rotation)
By default, items are displayed at a scale of 1 (i.e. at their
normal size).
- Scaling is from the item's origin (0,0).
+ Scaling is from the item's transformOrigin.
\table
\row
@@ -1547,7 +1547,7 @@ void QFxItem::setRotation(qreal rotation)
By default, items are displayed at a scale of 1 (i.e. at their
normal size).
- Scaling is from the item's origin (0,0).
+ Scaling is from the item's transformOrigin.
*/
qreal QFxItem::scale() const
{
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index 031c0f8..9550af9 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -183,7 +183,6 @@ void QFxText::setText(const QString &n)
/*!
\qmlproperty string Text::text
- \default
The text to display. Text supports both plain and rich text strings.
diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h
index 99ab2be..b929a6f 100644
--- a/src/declarative/fx/qfxtext.h
+++ b/src/declarative/fx/qfxtext.h
@@ -69,7 +69,6 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem
Q_PROPERTY(bool wrap READ wrap WRITE setWrap)
Q_PROPERTY(Qt::TextElideMode elide READ elideMode WRITE setElideMode)
Q_PROPERTY(QString activeLink READ activeLink)
- Q_CLASSINFO("DefaultProperty", "text")
public:
QFxText(QFxItem *parent=0);
diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp
index 5f2f36c..03dd63f 100644
--- a/src/declarative/fx/qfxtextedit.cpp
+++ b/src/declarative/fx/qfxtextedit.cpp
@@ -138,7 +138,6 @@ QString QFxTextEdit::text() const
/*!
\qmlproperty string TextEdit::text
- \default
The text to display. If the text format is AutoText the text edit will
automatically determine whether the text should be treated as
diff --git a/src/declarative/util/qmlconnection.h b/src/declarative/util/qmlconnection.h
index 4350123..d61659f 100644
--- a/src/declarative/util/qmlconnection.h
+++ b/src/declarative/util/qmlconnection.h
@@ -61,7 +61,6 @@ class Q_DECLARATIVE_EXPORT QmlConnection : public QObject, public QmlParserStatu
Q_DECLARE_PRIVATE(QmlConnection)
Q_INTERFACES(QmlParserStatus)
- Q_CLASSINFO("DefaultProperty", "script")
Q_PROPERTY(QObject *sender READ signalSender WRITE setSignalSender)
Q_PROPERTY(QString script READ script WRITE setScript)
Q_PROPERTY(QString signal READ signal WRITE setSignal)
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
index abe6d96..4830169 100644
--- a/tests/auto/declarative/anchors/tst_anchors.cpp
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -17,6 +17,8 @@ private slots:
void basicAnchors();
void loops();
void illegalSets();
+ void reset();
+ void nullItem();
};
/*
@@ -154,6 +156,30 @@ void tst_anchors::illegalSets()
}
}
+void tst_anchors::reset()
+{
+ QFxItem *aItem = new QFxItem;
+ QFxAnchorLine anchor;
+ anchor.item = aItem;
+ anchor.anchorLine = QFxAnchorLine::Top;
+
+ QFxItem *item = new QFxItem;
+ item->anchors()->setBottom(anchor);
+ QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), true);
+
+ item->anchors()->resetBottom();
+ QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), false);
+}
+
+void tst_anchors::nullItem()
+{
+ QFxAnchorLine anchor;
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxItem (unknown location): Can't anchor to a null item. ");
+ QFxItem *item = new QFxItem;
+ item->anchors()->setBottom(anchor);
+}
+
QTEST_MAIN(tst_anchors)
#include "tst_anchors.moc"