aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-01-19 10:49:56 +0100
committerLiang Qi <liang.qi@qt.io>2018-01-24 09:34:11 +0100
commit2570b801c74832a3c83a8b56ad0f76812969e190 (patch)
treec4bd64d8e6b15b507f51f550ba13a0c062528d65 /examples
parent1b96186d1418adcba85fdbfd794da2d2f6ea122d (diff)
parent706a6647db695cdeb854ef1bf956ded56b498f78 (diff)
Merge remote-tracking branch 'origin/5.9' into 5.10
Conflicts: .qmake.conf src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata_p.h src/qml/debugger/qqmlprofiler_p.h src/qml/jsruntime/qv4engine.cpp src/qml/memory/qv4mm.cpp src/qml/qml/qqmlcomponent.cpp src/qml/qml/qqmlobjectcreator.cpp src/qml/qml/qqmlobjectcreator_p.h src/qml/types/qqmldelegatemodel.cpp src/quick/items/qquickitem_p.h src/quick/items/qquickwindow.cpp tests/auto/quick/touchmouse/BLACKLIST tests/benchmarks/qml/holistic/tst_holistic.cpp Change-Id: I520f349ab4b048dd337d9647113564fc257865c2
Diffstat (limited to 'examples')
-rw-r--r--examples/quick/externaldraganddrop/DragAndDropTextItem.qml46
-rw-r--r--examples/quick/externaldraganddrop/externaldraganddrop.pro3
-rw-r--r--examples/quick/externaldraganddrop/externaldraganddrop.qml2
-rw-r--r--examples/quick/scenegraph/threadedanimation/spinner.cpp7
-rw-r--r--examples/quick/shared/shared.h7
5 files changed, 34 insertions, 31 deletions
diff --git a/examples/quick/externaldraganddrop/DragAndDropTextItem.qml b/examples/quick/externaldraganddrop/DragAndDropTextItem.qml
index 7499c83e6d..9858a961c9 100644
--- a/examples/quick/externaldraganddrop/DragAndDropTextItem.qml
+++ b/examples/quick/externaldraganddrop/DragAndDropTextItem.qml
@@ -49,32 +49,36 @@
****************************************************************************/
import QtQuick 2.2
+import "../shared" as Examples
Rectangle {
id: item
property string display
- color: "#EEE"
+ property alias dropEnabled: acceptDropCB.checked
+ color: dropArea.containsDrag ? "#CFC" : "#EEE"
+ ColorAnimation on color {
+ id: rejectAnimation
+ from: "#FCC"
+ to: "#EEE"
+ duration: 1000
+ }
Text {
anchors.fill: parent
text: item.display
wrapMode: Text.WordWrap
}
DropArea {
+ id: dropArea
anchors.fill: parent
keys: ["text/plain"]
- onEntered: {
- item.color = "#FCC"
- }
- onExited: {
- item.color = "#EEE"
+ onEntered: if (!acceptDropCB.checked) {
+ drag.accepted = false
+ rejectAnimation.start()
}
- onDropped: {
- item.color = "#EEE"
- if (drop.hasText) {
- if (drop.proposedAction == Qt.MoveAction || drop.proposedAction == Qt.CopyAction) {
- item.display = drop.text
- drop.acceptProposedAction()
- }
+ onDropped: if (drop.hasText && acceptDropCB.checked) {
+ if (drop.proposedAction == Qt.MoveAction || drop.proposedAction == Qt.CopyAction) {
+ item.display = drop.text
+ drop.acceptProposedAction()
}
}
}
@@ -91,12 +95,12 @@ Rectangle {
Drag.hotSpot.y: 0
Drag.mimeData: { "text/plain": item.display }
Drag.dragType: Drag.Automatic
- Drag.onDragStarted: {
- }
- Drag.onDragFinished: {
- if (dropAction == Qt.MoveAction) {
- item.display = ""
- }
- }
- } // Item
+ Drag.onDragFinished: if (dropAction == Qt.MoveAction) item.display = ""
+ }
+ Examples.CheckBox {
+ id: acceptDropCB
+ anchors.right: parent.right
+ checked: true
+ text: "accept drop"
+ }
}
diff --git a/examples/quick/externaldraganddrop/externaldraganddrop.pro b/examples/quick/externaldraganddrop/externaldraganddrop.pro
index 646781e7d1..0a592a84f3 100644
--- a/examples/quick/externaldraganddrop/externaldraganddrop.pro
+++ b/examples/quick/externaldraganddrop/externaldraganddrop.pro
@@ -2,9 +2,10 @@ TEMPLATE = app
QT += quick qml
SOURCES += main.cpp
-RESOURCES += externaldraganddrop.qrc
+RESOURCES += externaldraganddrop.qrc ../shared/shared.qrc
EXAMPLE_FILES = \
+ externaldraganddrop.qml \
DragAndDropTextItem.qml
target.path = $$[QT_INSTALL_EXAMPLES]/quick/externaldraganddrop
diff --git a/examples/quick/externaldraganddrop/externaldraganddrop.qml b/examples/quick/externaldraganddrop/externaldraganddrop.qml
index 9c33d1e468..47a76a259a 100644
--- a/examples/quick/externaldraganddrop/externaldraganddrop.qml
+++ b/examples/quick/externaldraganddrop/externaldraganddrop.qml
@@ -82,8 +82,8 @@ Item {
DragAndDropTextItem {
Layout.fillWidth: true
height: 142
+ dropEnabled: false
display: "Drag out into other applications."
}
-
}
}
diff --git a/examples/quick/scenegraph/threadedanimation/spinner.cpp b/examples/quick/scenegraph/threadedanimation/spinner.cpp
index 7b4281aafc..83c4494720 100644
--- a/examples/quick/scenegraph/threadedanimation/spinner.cpp
+++ b/examples/quick/scenegraph/threadedanimation/spinner.cpp
@@ -66,8 +66,8 @@ public:
, m_spinning(false)
, m_window(window)
{
- connect(window, &QQuickWindow::beforeRendering, this, &SpinnerNode::maybeRotate);
- connect(window, &QQuickWindow::frameSwapped, this, &SpinnerNode::maybeUpdate);
+ connect(window, &QQuickWindow::beforeRendering, this, &SpinnerNode::maybeRotate, Qt::DirectConnection);
+ connect(window, &QQuickWindow::frameSwapped, this, &SpinnerNode::maybeUpdate, Qt::DirectConnection);
QImage image(":/scenegraph/threadedanimation/spinner.png");
m_texture = window->createTextureFromImage(image);
@@ -96,6 +96,9 @@ public slots:
matrix.rotate(m_rotation, 0, 0, 1);
matrix.translate(-32, -32);
setMatrix(matrix);
+
+ // If we're inside a QQuickWidget, this call is necessary to ensure the widget gets updated.
+ m_window->update();
}
}
diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h
index c25d0475af..18e7ff056b 100644
--- a/examples/quick/shared/shared.h
+++ b/examples/quick/shared/shared.h
@@ -77,11 +77,6 @@
if (view.status() == QQuickView::Error)\
return -1;\
view.setResizeMode(QQuickView::SizeRootObjectToView);\
- if (QGuiApplication::platformName() == QLatin1String("qnx") || \
- QGuiApplication::platformName() == QLatin1String("eglfs")) {\
- view.showFullScreen();\
- } else {\
- view.show();\
- }\
+ view.show();\
return app.exec();\
}