summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-08 02:23:09 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-08 02:23:09 (GMT)
commitdb3fcbbb2368266d60781189648951ff17895b1e (patch)
tree24d6061b3b62f252f980e9b81080ebbd4ae3822a /src
parenta51eb694a9a43227733dbfc4373779d84d435144 (diff)
parentcb22daf607a99bf01a8e3263599f0dd8ee018707 (diff)
downloadQt-db3fcbbb2368266d60781189648951ff17895b1e.zip
Qt-db3fcbbb2368266d60781189648951ff17895b1e.tar.gz
Qt-db3fcbbb2368266d60781189648951ff17895b1e.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp2
-rw-r--r--src/declarative/qml/qdeclarativevaluetype.cpp18
-rw-r--r--src/declarative/qml/qdeclarativevaluetype_p.h3
-rw-r--r--src/declarative/util/qdeclarativestate.cpp18
4 files changed, 30 insertions, 11 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index c95bd29..a6cc75e 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -651,7 +651,7 @@ bool QDeclarativeMouseArea::setPressed(bool p)
emit positionChanged(&me);
} else {
emit released(&me);
- if (isclick)
+ if (isclick && !d->longPress)
emit clicked(&me);
}
diff --git a/src/declarative/qml/qdeclarativevaluetype.cpp b/src/declarative/qml/qdeclarativevaluetype.cpp
index 839e0dd..49e7b79 100644
--- a/src/declarative/qml/qdeclarativevaluetype.cpp
+++ b/src/declarative/qml/qdeclarativevaluetype.cpp
@@ -619,7 +619,7 @@ void QDeclarativeEasingValueType::setPeriod(qreal period)
}
QDeclarativeFontValueType::QDeclarativeFontValueType(QObject *parent)
-: QDeclarativeValueType(parent), hasPixelSize(false)
+: QDeclarativeValueType(parent), pixelSizeSet(false), pointSizeSet(false)
{
}
@@ -627,6 +627,8 @@ void QDeclarativeFontValueType::read(QObject *obj, int idx)
{
void *a[] = { &font, 0 };
QMetaObject::metacall(obj, QMetaObject::ReadProperty, idx, a);
+ pixelSizeSet = false;
+ pointSizeSet = false;
}
void QDeclarativeFontValueType::write(QObject *obj, int idx, QDeclarativePropertyPrivate::WriteFlags flags)
@@ -724,13 +726,17 @@ qreal QDeclarativeFontValueType::pointSize() const
void QDeclarativeFontValueType::setPointSize(qreal size)
{
- if (hasPixelSize) {
+ if (pixelSizeSet) {
qWarning() << "Both point size and pixel size set. Using pixel size.";
return;
}
- if (size >= 0.0)
+ if (size >= 0.0) {
+ pointSizeSet = true;
font.setPointSizeF(size);
+ } else {
+ pointSizeSet = false;
+ }
}
int QDeclarativeFontValueType::pixelSize() const
@@ -741,10 +747,12 @@ int QDeclarativeFontValueType::pixelSize() const
void QDeclarativeFontValueType::setPixelSize(int size)
{
if (size >=0) {
+ if (pointSizeSet)
+ qWarning() << "Both point size and pixel size set. Using pixel size.";
font.setPixelSize(size);
- hasPixelSize = true;
+ pixelSizeSet = true;
} else {
- hasPixelSize = false;
+ pixelSizeSet = false;
}
}
diff --git a/src/declarative/qml/qdeclarativevaluetype_p.h b/src/declarative/qml/qdeclarativevaluetype_p.h
index 1fe8bd2..763177d 100644
--- a/src/declarative/qml/qdeclarativevaluetype_p.h
+++ b/src/declarative/qml/qdeclarativevaluetype_p.h
@@ -399,7 +399,8 @@ public:
private:
QFont font;
- bool hasPixelSize;
+ bool pixelSizeSet;
+ bool pointSizeSet;
};
QT_END_NAMESPACE
diff --git a/src/declarative/util/qdeclarativestate.cpp b/src/declarative/util/qdeclarativestate.cpp
index 5e6c35e..e4c968e 100644
--- a/src/declarative/util/qdeclarativestate.cpp
+++ b/src/declarative/util/qdeclarativestate.cpp
@@ -121,14 +121,13 @@ QDeclarativeStateOperation::QDeclarativeStateOperation(QObjectPrivate &dd, QObje
/*!
\qmlclass State QDeclarativeState
- \since 4.7
+ \since 4.7
\brief The State element defines configurations of objects and properties.
A state is specified as a set of batched changes from the default configuration.
- Note that setting the state of an object from within another state of the same object is
- inadvisible. Not only would this have the same effect as going directly to the second state
- it may cause the program to crash.
+ \note setting the state of an object from within another state of the same object is
+ not allowed.
\sa {qmlstates}{States}, {state-transitions}{Transitions}
*/
@@ -191,6 +190,17 @@ bool QDeclarativeState::isWhenKnown() const
This should be set to an expression that evaluates to true when you want the state to
be applied.
+
+ If multiple states in a group have \c when clauses that evaluate to true at the same time,
+ the first matching state will be applied. For example, in the following snippet
+ \c state1 will always be selected rather than \c state2 when sharedCondition becomes
+ \c true.
+ \qml
+ states: [
+ State { name: "state1"; when: sharedCondition },
+ State { name: "state2"; when: sharedCondition }
+ ]
+ \endqml
*/
QDeclarativeBinding *QDeclarativeState::when() const
{