summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-07-14 02:32:21 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-07-14 02:32:21 (GMT)
commit32c2412d55d2387e8b05892fe1b1d2d54b624d02 (patch)
tree07156d15d54125620799e2866cc259c564ac79ea
parenta675b9ef9f85fa4a2fa245cd164d1e330b703bd9 (diff)
parent07ebc9161263c04dc072b9fc2a922b9665cbe7be (diff)
downloadQt-32c2412d55d2387e8b05892fe1b1d2d54b624d02.zip
Qt-32c2412d55d2387e8b05892fe1b1d2d54b624d02.tar.gz
Qt-32c2412d55d2387e8b05892fe1b1d2d54b624d02.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--demos/declarative/flickr/mobile/TitleBar.qml1
-rw-r--r--demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml4
-rw-r--r--demos/declarative/twitter/TwitterCore/AuthView.qml2
-rw-r--r--demos/declarative/twitter/TwitterCore/HomeTitleBar.qml1
-rw-r--r--demos/declarative/twitter/TwitterCore/TitleBar.qml1
-rw-r--r--doc/src/declarative/anchor-layout.qdoc5
-rw-r--r--doc/src/declarative/basictypes.qdoc3
-rw-r--r--doc/src/images/qml-mousearea-example.pngbin5527 -> 6969 bytes
-rw-r--r--doc/src/images/qml-xmllistmodel-example.pngbin0 -> 5252 bytes
-rw-r--r--doc/src/snippets/declarative/mousearea.qml13
-rw-r--r--examples/declarative/cppextensions/imageprovider/imageprovider.cpp2
-rw-r--r--examples/declarative/touchinteraction/mousearea/mousearea-example.qml64
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp30
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp59
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp7
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp10
-rw-r--r--src/declarative/qml/qdeclarativeimageprovider.cpp16
-rw-r--r--src/declarative/util/qdeclarativestateoperations.cpp2
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp17
-rw-r--r--tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp10
-rw-r--r--tools/qml/deviceorientation_symbian.cpp12
-rw-r--r--tools/qml/main.cpp11
-rw-r--r--tools/qml/qml.pro1
24 files changed, 154 insertions, 123 deletions
diff --git a/demos/declarative/flickr/mobile/TitleBar.qml b/demos/declarative/flickr/mobile/TitleBar.qml
index c7e1a53..335c315 100644
--- a/demos/declarative/flickr/mobile/TitleBar.qml
+++ b/demos/declarative/flickr/mobile/TitleBar.qml
@@ -109,6 +109,7 @@ Item {
Item {
id: returnKey
Keys.onReturnPressed: container.accept()
+ Keys.onEnterPressed: container.accept()
Keys.onEscapePressed: titleBar.state = ""
}
}
diff --git a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
index 6109535..be7dfa4 100644
--- a/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
+++ b/demos/declarative/photoviewer/PhotoViewerCore/EditableButton.qml
@@ -64,6 +64,10 @@ Item {
container.labelChanged(textInput.text)
container.focus = true
}
+ Keys.onEnterPressed: {
+ container.labelChanged(textInput.text)
+ container.focus = true
+ }
Keys.onEscapePressed: {
textInput.text = container.label
container.focus = true
diff --git a/demos/declarative/twitter/TwitterCore/AuthView.qml b/demos/declarative/twitter/TwitterCore/AuthView.qml
index 4f75777..0d05deb 100644
--- a/demos/declarative/twitter/TwitterCore/AuthView.qml
+++ b/demos/declarative/twitter/TwitterCore/AuthView.qml
@@ -115,6 +115,7 @@ Item {
KeyNavigation.tab: guest
KeyNavigation.backtab: passIn
Keys.onReturnPressed: login.doLogin();
+ Keys.onEnterPressed: login.doLogin();
Keys.onSelectPressed: login.doLogin();
Keys.onSpacePressed: login.doLogin();
onClicked: login.doLogin();
@@ -135,6 +136,7 @@ Item {
KeyNavigation.tab: nameIn
KeyNavigation.backtab: login
Keys.onReturnPressed: guest.doGuest();
+ Keys.onEnterPressed: guest.doGuest();
Keys.onSelectPressed: guest.doGuest();
Keys.onSpacePressed: guest.doGuest();
onClicked: guest.doGuest();
diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
index b26f7b3..56f31b1 100644
--- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml
@@ -136,6 +136,7 @@ Item {
Item {
id: returnKey
Keys.onReturnPressed: container.accept()
+ Keys.onEnterPressed: container.accept()
Keys.onEscapePressed: titleBar.state = ""
}
}
diff --git a/demos/declarative/twitter/TwitterCore/TitleBar.qml b/demos/declarative/twitter/TwitterCore/TitleBar.qml
index 6cd0a50..558bc18 100644
--- a/demos/declarative/twitter/TwitterCore/TitleBar.qml
+++ b/demos/declarative/twitter/TwitterCore/TitleBar.qml
@@ -98,6 +98,7 @@ Item {
Item {
id: returnKey
Keys.onReturnPressed: container.accept()
+ Keys.onEnterPressed: container.accept()
Keys.onEscapePressed: titleBar.state = ""
}
}
diff --git a/doc/src/declarative/anchor-layout.qdoc b/doc/src/declarative/anchor-layout.qdoc
index 9c217e1..5c025e5 100644
--- a/doc/src/declarative/anchor-layout.qdoc
+++ b/doc/src/declarative/anchor-layout.qdoc
@@ -33,7 +33,10 @@
In addition to the more traditional \l Grid, \l Row, and \l Column,
QML also provides a way to layout items using the concept of \e anchors.
Each item can be thought of as having a set of 7 invisible "anchor lines":
-\e left, \e horizontalCenter, \e right, \e top, \e verticalCenter, \e baseline, and \e bottom.
+\l {Item::anchors.left}{left}, \l {Item::anchors.horizontalCenter}{horizontalCenter},
+\l {Item::anchors.right}{right}, \l {Item::anchors.top}{top},
+\l {Item::anchors.verticalCenter}{verticalCenter}, \l {Item::anchors.baseline}{baseline},
+and \l {Item::anchors.bottom}{bottom}.
\image edges_qml.png
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc
index 109e6d5..e327d4a 100644
--- a/doc/src/declarative/basictypes.qdoc
+++ b/doc/src/declarative/basictypes.qdoc
@@ -107,6 +107,9 @@
Text { text: "Hello world!" }
\endqml
+ Strings have a \c length attribute that holds the number of
+ characters in the string.
+
\sa {QML Basic Types}
*/
diff --git a/doc/src/images/qml-mousearea-example.png b/doc/src/images/qml-mousearea-example.png
index c6e52d6..c0eef7f 100644
--- a/doc/src/images/qml-mousearea-example.png
+++ b/doc/src/images/qml-mousearea-example.png
Binary files differ
diff --git a/doc/src/images/qml-xmllistmodel-example.png b/doc/src/images/qml-xmllistmodel-example.png
new file mode 100644
index 0000000..be2d15d
--- /dev/null
+++ b/doc/src/images/qml-xmllistmodel-example.png
Binary files differ
diff --git a/doc/src/snippets/declarative/mousearea.qml b/doc/src/snippets/declarative/mousearea.qml
index 8e7c737..fb6cba0 100644
--- a/doc/src/snippets/declarative/mousearea.qml
+++ b/doc/src/snippets/declarative/mousearea.qml
@@ -83,17 +83,18 @@ Rectangle {
id: container
width: 600; height: 200
- Image {
- id: pic
- source: "pics/qt.png"
- opacity: (600.0 - pic.x) / 600
+ Rectangle {
+ id: rect
+ width: 50; height: 50
+ color: "red"
+ opacity: (600.0 - rect.x) / 600
MouseArea {
anchors.fill: parent
- drag.target: pic
+ drag.target: rect
drag.axis: Drag.XAxis
drag.minimumX: 0
- drag.maximumX: container.width - pic.width
+ drag.maximumX: container.width - rect.width
}
}
}
diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.cpp b/examples/declarative/cppextensions/imageprovider/imageprovider.cpp
index 995192a..18d027e 100644
--- a/examples/declarative/cppextensions/imageprovider/imageprovider.cpp
+++ b/examples/declarative/cppextensions/imageprovider/imageprovider.cpp
@@ -54,7 +54,7 @@ class ColorImageProvider : public QDeclarativeImageProvider
{
public:
ColorImageProvider()
- : QDeclarativeImageProvider(Pixmap)
+ : QDeclarativeImageProvider(QDeclarativeImageProvider::Pixmap)
{
}
diff --git a/examples/declarative/touchinteraction/mousearea/mousearea-example.qml b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml
index 64f72a9..85ea2dc 100644
--- a/examples/declarative/touchinteraction/mousearea/mousearea-example.qml
+++ b/examples/declarative/touchinteraction/mousearea/mousearea-example.qml
@@ -44,59 +44,69 @@ Rectangle {
id: box
width: 350; height: 250
- function showInfo(text) {
- statusText.text = text
- }
-
Rectangle {
+ id: redSquare
width: 80; height: 80
+ anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 10
color: "red"
Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent }
MouseArea {
- anchors.fill: parent
+ anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
- onPressed: box.showInfo('Pressed (x=' + mouse.x + ' y=' + mouse.y + ' button='
- + (mouse.button == Qt.RightButton ? 'right' : 'left')
- + ' Shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')')
- onReleased: box.showInfo('Released (x=' + mouse.x + ' y=' + mouse.y
- + ' isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')')
- onClicked: box.showInfo('Clicked (x=' + mouse.x + ' y=' + mouse.y + ' wasHeld=' + mouse.wasHeld + ')')
- onDoubleClicked: box.showInfo('Double clicked (x=' + mouse.x + ' y=' + mouse.y + ')')
- onPressAndHold: box.showInfo('Press and hold')
- onEntered: box.showInfo('Entered (pressed=' + pressed + ')')
- onExited: box.showInfo('Exited (pressed=' + pressed + ')')
+ onEntered: info.text = 'Entered'
+ onExited: info.text = 'Exited (pressed=' + pressed + ')'
+
+ onPressed: {
+ info.text = 'Pressed (button=' + (mouse.button == Qt.RightButton ? 'right' : 'left')
+ + ' shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')'
+ var posInBox = redSquare.mapToItem(box, mouse.x, mouse.y)
+ posInfo.text = + mouse.x + ',' + mouse.y + ' in square'
+ + ' (' + posInBox.x + ',' + posInBox.y + ' in window)'
+ }
+
+ onReleased: {
+ info.text = 'Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')'
+ posInfo.text = ''
+ }
+
+ onPressAndHold: info.text = 'Press and hold'
+ onClicked: info.text = 'Clicked (wasHeld=' + mouse.wasHeld + ')'
+ onDoubleClicked: info.text = 'Double clicked'
}
}
Rectangle {
- width: 80; height: 80; anchors.right: parent.right
+ id: blueSquare
+ width: 80; height: 80
+ x: box.width - width - 10; y: 10 // making this item draggable, so don't use anchors
color: "blue"
Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent }
MouseArea {
anchors.fill: parent
- drag.target: parent
- drag.axis: Drag.XAxis
+ drag.target: blueSquare
+ drag.axis: Drag.XandYAxis
drag.minimumX: 0
- drag.maximumX: 150
-
- onPressed: box.showInfo('Pressed')
- onReleased: box.showInfo('Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')')
- onClicked: box.showInfo('Clicked' + ' (wasHeld=' + mouse.wasHeld + ')')
- onDoubleClicked: box.showInfo('Double clicked')
- onPressAndHold: box.showInfo('Press and hold')
+ drag.maximumX: box.width - parent.width
+ drag.minimumY: 0
+ drag.maximumY: box.height - parent.width
}
}
Text {
- id: statusText
- anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30
+ id: info
+ anchors.bottom: posInfo.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30
onTextChanged: console.log(text)
}
+
+ Text {
+ id: posInfo
+ anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30
+ }
}
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index c3e0808..2a52044 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -47,8 +47,6 @@
#include <unistd.h>
#include <errno.h>
-#include <net/if.h>
-
QT_BEGIN_NAMESPACE
#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
@@ -100,16 +98,19 @@ static inline int qt_socket_select(int nfds, fd_set *readfds, fd_set *writefds,
class QSelectMutexGrabber
{
public:
- QSelectMutexGrabber(int fd, QMutex *mutex)
+ QSelectMutexGrabber(int writeFd, int readFd, QMutex *mutex)
: m_mutex(mutex)
{
if (m_mutex->tryLock())
return;
char dummy = 0;
- qt_pipe_write(fd, &dummy, 1);
+ qt_pipe_write(writeFd, &dummy, 1);
m_mutex->lock();
+
+ char buffer;
+ while (::read(readFd, &buffer, 1) > 0) {}
}
~QSelectMutexGrabber()
@@ -403,10 +404,6 @@ void QSelectThread::run()
ret = qt_socket_select(maxfd, &readfds, &writefds, &exceptionfds, 0);
savedSelectErrno = errno;
- char buffer;
-
- while (::read(m_pipeEnds[0], &buffer, 1) > 0) {}
-
if(ret == 0) {
// do nothing
} else if (ret < 0) {
@@ -481,7 +478,8 @@ void QSelectThread::run()
updateActivatedNotifiers(QSocketNotifier::Write, &writefds);
}
- m_waitCond.wait(&m_mutex);
+ if (FD_ISSET(m_pipeEnds[0], &readfds))
+ m_waitCond.wait(&m_mutex);
}
m_mutex.unlock();
@@ -497,7 +495,7 @@ void QSelectThread::requestSocketEvents ( QSocketNotifier *notifier, TRequestSta
Q_ASSERT(QThread::currentThread() == this->thread());
- QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
+ QSelectMutexGrabber lock(m_pipeEnds[1], m_pipeEnds[0], &m_mutex);
Q_ASSERT(!m_AOStatuses.contains(notifier));
@@ -510,7 +508,7 @@ void QSelectThread::cancelSocketEvents ( QSocketNotifier *notifier )
{
Q_ASSERT(QThread::currentThread() == this->thread());
- QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
+ QSelectMutexGrabber lock(m_pipeEnds[1], m_pipeEnds[0], &m_mutex);
m_AOStatuses.remove(notifier);
@@ -521,7 +519,7 @@ void QSelectThread::restart()
{
Q_ASSERT(QThread::currentThread() == this->thread());
- QSelectMutexGrabber lock(m_pipeEnds[1], &m_mutex);
+ QSelectMutexGrabber lock(m_pipeEnds[1], m_pipeEnds[0], &m_mutex);
m_waitCond.wakeAll();
}
@@ -577,17 +575,13 @@ void QSelectThread::updateActivatedNotifiers(QSocketNotifier::Type type, fd_set
* check if socket is in exception set
* then signal RequestComplete for it
*/
- qWarning("exception on %d [will do setdefaultif(0) - hack]", i.key()->socket());
+ qWarning("exception on %d [will close the socket handle - hack]", i.key()->socket());
// quick fix; there is a bug
// when doing read on socket
// errors not preoperly mapped
// after offline-ing the device
// on some devices we do get exception
- // close all exiting sockets
- // and reset default IAP
- if(::setdefaultif(0) != KErrNone) // well we can't do much about it
- qWarning("setdefaultif(0) failed");
-
+ ::close(i.key()->socket());
toRemove.append(i.key());
TRequestStatus *status = i.value();
QEventDispatcherSymbian::RequestComplete(d->threadData->symbian_thread_handle, status, KErrNone);
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index 34d33f5..90738c8 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -324,17 +324,34 @@ qreal QDeclarativeImage::paintedHeight() const
/*!
\qmlproperty QSize Image::sourceSize
- This property holds the size of the loaded image, in pixels.
+ This property holds the actual width and height of the loaded image.
- This is used to control the storage used by a loaded image. Unlike
- the width and height properties, which scale the painting of the image, this property
- affects the number of pixels stored.
+ Unlike the \l {Item::}{width} and \l {Item::}{height} properties, which scale
+ the painting of the image, this property sets the actual number of pixels
+ stored for the loaded image so that large images do not use more
+ memory than necessary. For example, this ensures the image is memory is no
+ larger than 1024x1024 pixels, regardless of the Image's \l {Item::}{width} and
+ \l {Item::}{height} values:
+
+ \code
+ Rectangle {
+ width: ...
+ height: ...
+
+ Image {
+ anchors.fill: parent
+ source: "reallyBigImage.jpg"
+ sourceSize.width: 1024
+ sourceSize.height: 1024
+ }
+ }
+ \endcode
If the image's actual size is larger than the sourceSize, the image is scaled down.
If only one dimension of the size is set to greater than 0, the
other dimension is set in proportion to preserve the source image's aspect ratio.
(The \l fillMode is independent of this.)
-
+
If the source is an instrinsically scalable image (eg. SVG), this property
determines the size of the loaded image regardless of intrinsic size.
Avoid changing this property dynamically; rendering an SVG is \e slow compared
@@ -344,34 +361,8 @@ qreal QDeclarativeImage::paintedHeight() const
be no greater than this property specifies. For some formats (currently only JPEG),
the whole image will never actually be loaded into memory.
- \note \e{Changing this property dynamically will lead to the image source being reloaded,
- potentially even from the network if it is not in the disk cache.}
-
- Here is an example that ensures the size of the image in memory is
- no larger than 1024x1024 pixels, regardless of the size of the Image element.
-
- \code
- Image {
- anchors.fill: parent
- source: "images/reallyBigImage.jpg"
- sourceSize.width: 1024
- sourceSize.height: 1024
- }
- \endcode
-
- The example below ensures the memory used by the image is no more than necessary
- to display the image at the size of the Image element.
- Of course if the Image element is resized a costly reload will be required, so
- use this technique \e only when the Image size is fixed.
-
- \code
- Image {
- anchors.fill: parent
- source: "images/reallyBigImage.jpg"
- sourceSize.width: width
- sourceSize.height: height
- }
- \endcode
+ \note \e {Changing this property dynamically causes the image source to be reloaded,
+ potentially even from the network, if it is not in the disk cache.}
*/
void QDeclarativeImage::updatePaintedGeometry()
@@ -415,6 +406,8 @@ void QDeclarativeImage::geometryChanged(const QRectF &newGeometry, const QRectF
Image can handle any image format supported by Qt, loaded from any URL scheme supported by Qt.
The URL may be absolute, or relative to the URL of the component.
+
+ \sa QDeclarativeImageProvider
*/
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 7022fac..190b22c 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -2097,7 +2097,7 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
relationship with other items.
Margins apply to top, bottom, left, right, and fill anchors.
- The margins property can be used to set all of the various margins at once, to the same value.
+ The \c anchors.margins property can be used to set all of the various margins at once, to the same value.
Offsets apply for horizontal center, vertical center, and baseline anchors.
@@ -2132,10 +2132,12 @@ QDeclarativeAnchorLine QDeclarativeItemPrivate::baseline() const
\endqml
\endtable
- anchors.fill provides a convenient way for one item to have the
+ \c anchors.fill provides a convenient way for one item to have the
same geometry as another item, and is equivalent to connecting all
four directional anchors.
+ To clear an anchor value, set it to \c undefined.
+
\note You can only anchor an item to siblings or a parent.
For more information see \l {anchor-layout}{Anchor Layouts}.
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 91e9995..cd26472 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -494,7 +494,7 @@ public:
QSmoothedAnimation *highlightSizeAnimator;
QDeclarativeViewSection *sectionCriteria;
QString currentSection;
- static const int sectionCacheSize = 3;
+ static const int sectionCacheSize = 4;
QDeclarativeItem *sectionCache[sectionCacheSize];
qreal spacing;
qreal highlightMoveSpeed;
@@ -1029,6 +1029,11 @@ void QDeclarativeListViewPrivate::updateCurrent(int modelIndex)
}
currentItem->item->setFocus(true);
currentItem->attached->setIsCurrentItem(true);
+ // Avoid showing section delegate twice. We still need the section heading so that
+ // currentItem positioning works correctly.
+ // This is slightly sub-optimal, but section heading caching minimizes the impact.
+ if (currentItem->section)
+ currentItem->section->setVisible(false);
}
updateHighlight();
emit q->currentIndexChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 7b65ca7..b7b0c9e 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -767,10 +767,16 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
\i \c drag.minimum and \c drag.maximum limit how far the target can be dragged along the corresponding axes.
\endlist
- The following example displays an image that can be dragged along the X-axis. The opacity
- of the image is reduced when it is dragged to the right.
+ The following example displays a \l Rectangle that can be dragged along the X-axis. The opacity
+ of the rectangle is reduced when it is dragged to the right.
\snippet doc/src/snippets/declarative/mousearea.qml drag
+
+ \note Items cannot be dragged if they are anchored for the requested
+ \c drag.axis. For example, if \c anchors.left or \c anchors.right was set
+ for \c rect in the above example, it cannot be dragged along the X-axis.
+ This can be avoided by settng the anchor value to \c undefined in
+ an \l onPressed handler.
*/
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeimageprovider.cpp b/src/declarative/qml/qdeclarativeimageprovider.cpp
index f38da4e..a294c38 100644
--- a/src/declarative/qml/qdeclarativeimageprovider.cpp
+++ b/src/declarative/qml/qdeclarativeimageprovider.cpp
@@ -180,9 +180,13 @@ QDeclarativeImageProvider::ImageType QDeclarativeImageProvider::imageType() cons
Implement this method to return the image with \a id. The default
implementation returns an empty image.
- If \a requestedSize is a valid size, the image returned should be of that size.
+ The \a requestedSize corresponds to the \l {Image::sourceSize} requested by
+ an Image element. If \a requestedSize is a valid size, the image
+ returned should be of that size.
- In all cases, \a size must be set to the original size of the image.
+ In all cases, \a size must be set to the original size of the image. This
+ is used to set the \l {Item::}{width} and \l {Item::}{height} of image
+ elements that should be automatically sized to the loaded image.
\note this method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
@@ -201,9 +205,13 @@ QImage QDeclarativeImageProvider::requestImage(const QString &id, QSize *size, c
Implement this method to return the pixmap with \a id. The default
implementation returns an empty pixmap.
- If \a requestedSize is a valid size, the image returned should be of that size.
+ The \a requestedSize corresponds to the \l {Image::sourceSize} requested by
+ an Image element. If \a requestedSize is a valid size, the image
+ returned should be of that size.
- In all cases, \a size must be set to the original size of the image.
+ In all cases, \a size must be set to the original size of the image. This
+ is used to set the \l {Item::}{width} and \l {Item::}{height} of image
+ elements that should be automatically sized to the loaded image.
\note this method may be called by multiple threads, so ensure the
implementation of this method is reentrant.
diff --git a/src/declarative/util/qdeclarativestateoperations.cpp b/src/declarative/util/qdeclarativestateoperations.cpp
index 51e6f99..5590449 100644
--- a/src/declarative/util/qdeclarativestateoperations.cpp
+++ b/src/declarative/util/qdeclarativestateoperations.cpp
@@ -1039,7 +1039,7 @@ public:
/*!
\qmlproperty Item AnchorChanges::target
- This property holds the Item whose anchors will change
+ This property holds the \l Item for which the anchor changes will be applied.
*/
QDeclarativeAnchorChanges::QDeclarativeAnchorChanges(QObject *parent)
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 00169db..9895ff2 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -508,8 +508,8 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
\since 4.7
\brief The XmlListModel element is used to specify a model using XPath expressions.
- XmlListModel is used to create a model from XML data. XmlListModel can be used as a data source
- for the view classes (such as ListView, PathView, GridView) and other classes that interact with model
+ XmlListModel is used to create a model from XML data. It can be used as a data source
+ for view elements (such as ListView, PathView, GridView) and other elements that interact with model
data (such as \l Repeater).
For example, if there is a XML document at http://www.mysite.com/feed.xml like this:
@@ -520,11 +520,11 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
...
<channel>
<item>
- <title>Item A</title>
+ <title>A blog post</title>
<pubDate>Sat, 07 Sep 2010 10:00:01 GMT</pubDate>
</item>
<item>
- <title>Item B</title>
+ <title>Another blog post</title>
<pubDate>Sat, 07 Sep 2010 15:35:01 GMT</pubDate>
</item>
</channel>
@@ -560,10 +560,17 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
ListView {
width: 180; height: 300
model: xmlModel
- delegate: Text { title + " (" + pubDate + ")" }
+ delegate: Text { text: title + " (" + pubDate + ")" }
}
\endqml
+ \image qml-xmllistmodel-example.png
+
+ The XmlListModel data is loaded asynchronously, and \l status
+ is set to \l XmlListModel::Ready when loading is complete.
+ Note this means when XmlListModel is used for a view, the view is not
+ populated until the model is loaded.
+
\section2 Using key XML roles
diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
index f15ac8f..858c26d 100644
--- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
+++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp
@@ -193,8 +193,9 @@ void tst_qdeclarativelistmodel::dynamic_data()
QTest::newRow("count") << "count" << 0 << "";
- QTest::newRow("get1") << "{get(0)}" << 0 << "";
- QTest::newRow("get2") << "{get(-1)}" << 0 << "";
+ QTest::newRow("get1") << "{get(0) === undefined}" << 1 << "";
+ QTest::newRow("get2") << "{get(-1) === undefined}" << 1 << "";
+ QTest::newRow("get3") << "{append({'foo':123});get(0) != undefined}" << 1 << "";
QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << "";
QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << "";
@@ -292,8 +293,6 @@ void tst_qdeclarativelistmodel::dynamic()
if (e.hasError())
qDebug() << e.error(); // errors not expected
- if (QTest::currentDataTag() != QLatin1String("clear3") && QTest::currentDataTag() != QLatin1String("remove3"))
- QVERIFY(!e.hasError());
QCOMPARE(actual,result);
}
@@ -308,6 +307,9 @@ void tst_qdeclarativelistmodel::dynamic_worker()
QFETCH(int, result);
QFETCH(QString, warning);
+ // This is same as dynamic() except it applies the test to a ListModel called
+ // from a WorkerScript (i.e. testing the internal NestedListModel class)
+
QDeclarativeListModel model;
QDeclarativeEngine eng;
QDeclarativeComponent component(&eng, QUrl::fromLocalFile(SRCDIR "/data/model.qml"));
diff --git a/tools/qml/deviceorientation_symbian.cpp b/tools/qml/deviceorientation_symbian.cpp
index 48bfc72..c305f94 100644
--- a/tools/qml/deviceorientation_symbian.cpp
+++ b/tools/qml/deviceorientation_symbian.cpp
@@ -118,18 +118,14 @@ private:
data = dataBuf();
Orientation o = UnknownOrientation;
switch (data.iDeviceOrientation) {
- case TSensrvOrientationData::EOrientationDisplayRightUp:
- o = LandscapeInverted;
- break;
case TSensrvOrientationData::EOrientationDisplayUp:
o = Portrait;
break;
- case TSensrvOrientationData::EOrientationDisplayDown:
- o = PortraitInverted;
- break;
- case TSensrvOrientationData::EOrientationDisplayLeftUp:
+ case TSensrvOrientationData::EOrientationDisplayRightUp:
o = Landscape;
break;
+ case TSensrvOrientationData::EOrientationDisplayLeftUp:
+ case TSensrvOrientationData::EOrientationDisplayDown:
case TSensrvOrientationData::EOrientationUndefined:
case TSensrvOrientationData::EOrientationDisplayUpwards:
case TSensrvOrientationData::EOrientationDisplayDownwards:
@@ -137,7 +133,7 @@ private:
break;
}
- if (m_current != o) {
+ if (m_current != o && o != UnknownOrientation) {
m_current = o;
emit orientationChanged();
}
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index dfd1726..4b1162e 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -56,9 +56,7 @@ QT_USE_NAMESPACE
QtMsgHandler systemMsgOutput = 0;
-#if defined(Q_WS_S60)
-#include <aknappui.h> // For locking app to portrait
-#endif
+
#if defined (Q_OS_SYMBIAN)
#include <unistd.h>
@@ -211,12 +209,7 @@ int main(int argc, char ** argv)
app.setOrganizationName("Nokia");
app.setOrganizationDomain("nokia.com");
-#if defined(Q_WS_S60)
- CAknAppUi *appUi = static_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
- if (appUi) {
- appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
- }
-#endif
+
QDeclarativeViewer::registerTypes();
QDeclarativeTester::registerTypes();
diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro
index 0a51c0b..bb69e8a 100644
--- a/tools/qml/qml.pro
+++ b/tools/qml/qml.pro
@@ -39,7 +39,6 @@ symbian {
TARGET.CAPABILITY = NetworkServices ReadUserData
!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
LIBS += -lsensrvclient -lsensrvutil
- contains(QT_CONFIG, s60): LIBS += -lavkon -lcone
}
}
mac {