From 7628316e6e8165415dd84f2f8744a3ddd29bd675 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Sun, 17 Dec 2017 23:03:21 +0100 Subject: Let platform decide what the default show action is The platform handles this through the ShowIsMaximized and ShowIsFullScreen platform integration style-hints, as well as QPlatformIntegration::defaultWindowState(), which was added specifically so that we wouldn't have to hard-code the behavior in user code. Change-Id: Ic019ccc2edd871a78bf94fd5fe572b9659416582 Reviewed-by: Laszlo Agocs --- examples/quick/shared/shared.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'examples/quick') diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index 6194a56dfd..317d8c70cb 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -72,11 +72,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();\ } -- cgit v1.2.3 From 8a7e205eed38ff506d3768083047d1caf8481303 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 12 Dec 2017 12:06:48 +0100 Subject: threadedanimation: fix custom item animation when in a QQuickWidget As with 64a01ff5b5d1eaadb1e60013673ac25459b79e14 in qtquickcontrols2, we ensure that custom scenegraph item animations still run if within a QQuickWidget. Change-Id: I3630ee34c039420640000c9a58ed1ec186bbe82c Reviewed-by: J-P Nurmi --- examples/quick/scenegraph/threadedanimation/spinner.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'examples/quick') 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(); } } -- cgit v1.2.3 From 6f6fa9ee929292639a24f2b15c432a41df92610d Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 1 Mar 2017 09:10:50 +0100 Subject: externaldraganddrop example: add checkbox to control accepting drop DropArea.onEntered can reject the drop - this will provide cursor and color change feedback showing whether dropping is allowed. Change-Id: I2203cda79cf381bbb71724cdcd6aecd8f001d62d Reviewed-by: Shawn Rutledge --- .../externaldraganddrop/DragAndDropTextItem.qml | 46 ++++++++++++---------- .../externaldraganddrop/externaldraganddrop.pro | 3 +- .../externaldraganddrop/externaldraganddrop.qml | 2 +- 3 files changed, 28 insertions(+), 23 deletions(-) (limited to 'examples/quick') 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." } - } } -- cgit v1.2.3