aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2022-03-31 10:43:33 +0800
committerMitch Curtis <mitch.curtis@qt.io>2022-03-31 10:43:33 +0800
commitc7a8e5e2d30a7bddd8c883b68d212571b5b3c19c (patch)
tree63838703d397b67d41e9a25f5309ade43e1d598a /examples
parent1f4851e3eb0798876b1f0328a4bb3889f98506c9 (diff)
parent0c7b0a43064c8be452f4be74701f1dabce87f24c (diff)
Merge remote-tracking branch 'origin/dev' into wip/iosstyle
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt2
-rw-r--r--examples/qml/CMakeLists.txt5
-rw-r--r--examples/qml/qml-i18n/CMakeLists.txt44
-rw-r--r--examples/quick/models/objectlistmodel/main.cpp30
-rw-r--r--examples/quick/models/objectlistmodel/view.qml9
-rw-r--r--examples/quick/pointerhandlers/sidebar.qml10
-rw-r--r--examples/quick/quickwidgets/CMakeLists.txt2
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/CMakeLists.txt (renamed from examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt)21
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/images/qquickwidgetversuswindow-opengl-example.jpgbin0 -> 25452 bytes
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/src/qquickwidgetversuswindow_opengl.qdoc62
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/fbitem.cpp (renamed from examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/fbitem.h (renamed from examples/quick/quickwidgets/qquickviewcomparison/fbitem.h)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/logo.cpp (renamed from examples/quick/quickwidgets/qquickviewcomparison/logo.cpp)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/logo.h (renamed from examples/quick/quickwidgets/qquickviewcomparison/logo.h)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/main.cpp (renamed from examples/quick/quickwidgets/qquickviewcomparison/main.cpp)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/mainwindow.cpp (renamed from examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp)2
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/mainwindow.h (renamed from examples/quick/quickwidgets/qquickviewcomparison/mainwindow.h)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/qquickwidgetversuswindow_opengl.pro (renamed from examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.pro)6
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/qquickwidgetversuswindow_opengl.qrc (renamed from examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.qrc)2
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/test.qml (renamed from examples/quick/quickwidgets/qquickviewcomparison/test.qml)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/wobble.frag (renamed from examples/quick/quickwidgets/qquickviewcomparison/wobble.frag)0
-rw-r--r--examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/wobble.frag.qsb (renamed from examples/quick/quickwidgets/qquickviewcomparison/wobble.frag.qsb)bin1717 -> 1717 bytes
-rw-r--r--examples/quick/quickwidgets/quickwidget/CMakeLists.txt3
-rw-r--r--examples/quick/quickwidgets/quickwidget/customgl.qml69
-rw-r--r--examples/quick/quickwidgets/quickwidget/fbitem.cpp100
-rw-r--r--examples/quick/quickwidgets/quickwidget/fbitem.h64
-rw-r--r--examples/quick/quickwidgets/quickwidget/main.cpp79
-rw-r--r--examples/quick/quickwidgets/quickwidget/quickwidget.pro3
-rw-r--r--examples/quick/quickwidgets/quickwidget/quickwidget.qrc2
-rw-r--r--examples/quick/quickwidgets/quickwidget/rotatingsquare.qml29
-rw-r--r--examples/quick/quickwidgets/quickwidget/rotatingsquaretab.qml76
-rw-r--r--examples/quick/quickwidgets/quickwidgets.pro2
-rw-r--r--examples/quick/text/textselection/textselection.qml4
-rw-r--r--examples/quickcontrols2/CMakeLists.txt4
34 files changed, 242 insertions, 388 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 86b8aaad1a..861b34e33c 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,5 +1,3 @@
-find_package(Qt6 REQUIRED COMPONENTS Sql)
-
qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(qml)
diff --git a/examples/qml/CMakeLists.txt b/examples/qml/CMakeLists.txt
index 459fe041c9..9601672513 100644
--- a/examples/qml/CMakeLists.txt
+++ b/examples/qml/CMakeLists.txt
@@ -1,10 +1,13 @@
-qt_internal_add_example(dynamicscene)
add_subdirectory(referenceexamples)
add_subdirectory(tutorials)
qt_internal_add_example(shell)
if(TARGET Qt::Quick)
qt_internal_add_example(qmlextensionplugins)
qt_internal_add_example(xmlhttprequest)
+ if (TARGET Qt::lupdate)
+ qt_internal_add_example(qml-i18n)
+ endif()
+ qt_internal_add_example(dynamicscene)
endif()
if(QT_FEATURE_qml_network AND TARGET Qt::Quick)
qt_internal_add_example(networkaccessmanagerfactory)
diff --git a/examples/qml/qml-i18n/CMakeLists.txt b/examples/qml/qml-i18n/CMakeLists.txt
new file mode 100644
index 0000000000..ad69bd6db6
--- /dev/null
+++ b/examples/qml/qml-i18n/CMakeLists.txt
@@ -0,0 +1,44 @@
+cmake_minimum_required(VERSION 3.16)
+project(qml-i18n LANGUAGES CXX)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+set(CMAKE_AUTOMOC ON)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qml/qmli18n")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick Qml LinguistTools)
+
+qt_add_executable(qmli18n WIN32 MACOSX_BUNDLE main.cpp)
+
+target_link_libraries(qmli18n PRIVATE
+ Qt::Core
+ Qt::Gui
+ Qt::Qml
+ Qt::Quick
+)
+
+qt_add_qml_module(qmli18n
+ URI dynamicscene
+ VERSION 1.0
+ QML_FILES
+ qml-i18n.qml
+ NO_RESOURCE_TARGET_PATH
+)
+
+qt_add_translations(qmli18n
+ TS_FILES
+ i18n/base.ts
+ i18n/qml_en.ts
+ i18n/qml_en_AU.ts
+ i18n/qml_fr.ts
+)
+
+install(TARGETS qmli18n
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/quick/models/objectlistmodel/main.cpp b/examples/quick/models/objectlistmodel/main.cpp
index cb8dac0638..5d406f356c 100644
--- a/examples/quick/models/objectlistmodel/main.cpp
+++ b/examples/quick/models/objectlistmodel/main.cpp
@@ -49,6 +49,7 @@
****************************************************************************/
#include <QGuiApplication>
+#include <QList>
#include <qqmlengine.h>
#include <qqmlcontext.h>
@@ -68,12 +69,28 @@ int main(int argc, char ** argv)
{
QGuiApplication app(argc, argv);
- QList<QObject *> dataList = {
- new DataObject("Item 1", "red"),
- new DataObject("Item 2", "green"),
- new DataObject("Item 3", "blue"),
- new DataObject("Item 4", "yellow")
- };
+ const QStringList colorList = {"red",
+ "green",
+ "blue",
+ "yellow"};
+
+ const QStringList moduleList = {"Core", "GUI", "Multimedia", "Multimedia Widgets", "Network",
+ "QML", "Quick", "Quick Controls", "Quick Dialogs",
+ "Quick Layouts", "Quick Test", "SQL", "Widgets", "3D",
+ "Android Extras", "Bluetooth", "Concurrent", "D-Bus",
+ "Gamepad", "Graphical Effects", "Help", "Image Formats",
+ "Location", "Mac Extras", "NFC", "OpenGL", "Platform Headers",
+ "Positioning", "Print Support", "Purchasing", "Quick Extras",
+ "Quick Timeline", "Quick Widgets", "Remote Objects", "Script",
+ "SCXML", "Script Tools", "Sensors", "Serial Bus",
+ "Serial Port", "Speech", "SVG", "UI Tools", "WebEngine",
+ "WebSockets", "WebView", "Windows Extras", "XML",
+ "XML Patterns", "Charts", "Network Authorization",
+ "Virtual Keyboard", "Quick 3D", "Quick WebGL"};
+
+ QList<QObject *> dataList;
+ for (const QString &module : moduleList)
+ dataList.append(new DataObject("Qt " + module, colorList.at(rand() % colorList.length())));
QQuickView view;
view.setResizeMode(QQuickView::SizeRootObjectToView);
@@ -85,4 +102,3 @@ int main(int argc, char ** argv)
return app.exec();
}
-
diff --git a/examples/quick/models/objectlistmodel/view.qml b/examples/quick/models/objectlistmodel/view.qml
index e8ec6197dc..4adc8ca84f 100644
--- a/examples/quick/models/objectlistmodel/view.qml
+++ b/examples/quick/models/objectlistmodel/view.qml
@@ -49,18 +49,21 @@
****************************************************************************/
import QtQuick
+import QtQuick.Controls
//![0]
ListView {
- width: 100; height: 100
+ id: listview
+ width: 200; height: 320
required model
+ ScrollBar.vertical: ScrollBar { }
delegate: Rectangle {
+ width: listview.width; height: 25
+
required color
required property string name
- height: 25
- width: 100
Text { text: parent.name }
}
}
diff --git a/examples/quick/pointerhandlers/sidebar.qml b/examples/quick/pointerhandlers/sidebar.qml
index 29727b5684..e5cfee21c9 100644
--- a/examples/quick/pointerhandlers/sidebar.qml
+++ b/examples/quick/pointerhandlers/sidebar.qml
@@ -212,12 +212,12 @@ Rectangle {
hoverEnabled: true
cursorShape: Qt.ClosedHandCursor
anchors.fill: parent
- }
- Loader {
- objectName: "bottomSidebarLoader"
- sourceComponent: buttonsAndStuff
- anchors.fill: parent
+ Loader {
+ objectName: "bottomSidebarLoader"
+ sourceComponent: buttonsAndStuff
+ anchors.fill: parent
+ }
}
Text {
diff --git a/examples/quick/quickwidgets/CMakeLists.txt b/examples/quick/quickwidgets/CMakeLists.txt
index e0537e1e01..f205e23600 100644
--- a/examples/quick/quickwidgets/CMakeLists.txt
+++ b/examples/quick/quickwidgets/CMakeLists.txt
@@ -1,2 +1,2 @@
qt_internal_add_example(quickwidget)
-qt_internal_add_example(qquickviewcomparison)
+qt_internal_add_example(qquickwidgetversuswindow_opengl)
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/CMakeLists.txt
index 2ac77c313c..c49bb915ec 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/CMakeLists.txt
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/CMakeLists.txt
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
-project(qquickviewcomparison LANGUAGES CXX)
+project(qquickwidgetversuswindow_opengl LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
@@ -7,23 +7,22 @@ if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/quickwidgets/qquickviewcomparison")
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/quickwidgets/qquickwidgetversuswindow_opengl")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickWidgets ShaderTools Widgets)
-qt_add_executable(qquickviewcomparison
+qt_add_executable(qquickwidgetversuswindow_opengl
fbitem.cpp fbitem.h
logo.cpp logo.h
main.cpp
mainwindow.cpp mainwindow.h
)
-set_target_properties(qquickviewcomparison PROPERTIES
+set_target_properties(qquickwidgetversuswindow_opengl PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-
-target_link_libraries(qquickviewcomparison PUBLIC
+target_link_libraries(qquickwidgetversuswindow_opengl PUBLIC
Qt::Core
Qt::Gui
Qt::Quick
@@ -31,24 +30,24 @@ target_link_libraries(qquickviewcomparison PUBLIC
Qt::Widgets
)
-qt_add_qml_module(qquickviewcomparison
+qt_add_qml_module(qquickwidgetversuswindow_opengl
URI fbitem
VERSION 1.0
QML_FILES test.qml
- RESOURCE_PREFIX /qquickviewcomparison
+ RESOURCE_PREFIX /qquickwidgetversuswindow_opengl
NO_RESOURCE_TARGET_PATH
)
-qt6_add_shaders(qquickviewcomparison "shaders"
+qt6_add_shaders(qquickwidgetversuswindow_opengl "shaders"
PRECOMPILE
OPTIMIZED
PREFIX
- "/qquickviewcomparison"
+ "/qquickwidgetversuswindow_opengl"
FILES
"wobble.frag"
)
-install(TARGETS qquickviewcomparison
+install(TARGETS qquickwidgetversuswindow_opengl
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/images/qquickwidgetversuswindow-opengl-example.jpg b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/images/qquickwidgetversuswindow-opengl-example.jpg
new file mode 100644
index 0000000000..584ac4ed69
--- /dev/null
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/images/qquickwidgetversuswindow-opengl-example.jpg
Binary files differ
diff --git a/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/src/qquickwidgetversuswindow_opengl.qdoc b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/src/qquickwidgetversuswindow_opengl.qdoc
new file mode 100644
index 0000000000..97ad7ddd8b
--- /dev/null
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/doc/src/qquickwidgetversuswindow_opengl.qdoc
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \title QQuickWidget - QQuickView Comparison Example
+ \example quickwidgets/qquickwidgetversuswindow_opengl
+ \brief Demonstrates the benefits of QQuickWidget over a QQuickView embedded as a native window.
+ \image qquickwidgetversuswindow-opengl-example.jpg
+
+ The example allows showing the same Qt Quick scene within the same
+ QWidget-based user interface using two different approaches: one is using a
+ QQuickView and using it as a child window and
+ QWidget::createWindowContainer(). The other is using QQuickWidget which
+ acts as a true QWidget and supports, among others, better clipping and
+ stacking, as is expected from a true QWidget.
+
+ The Qt Quick scene also uses direct OpenGL rendering, proving that with
+ QQuickWidget the rendering still happens using the accelerated 3D API. The
+ implication of this is that the example is tied to OpenGL and will not work
+ with other graphics APIs (Vulkan, Metal, Direct 3D).
+
+ Clicking on the Show Overlay checkbox demonstrates a widget stacking case
+ that is not rendering as expected when embedding a native window, while
+ QQuickWidget makes it render as expected.
+
+ Multisample antialiasing can also be exercised. When enabling it via the
+ corresponding checkbox, QQuickWidget will internally render into a
+ multisample renderbuffer, which is then resolved into a regular,
+ non-multisample 2D texture after each render pass, thus enabling
+ multisampling for the Qt Quick content without affecting the rest of the
+ QWidget UI. With QQuickView the native window will request multisampling
+ for its corresponding window surface, bringing similar results, if
+ supported by the platform.
+
+ The Qt Quick scene is interactive: typing into the text field is possible
+ regardless of which embedding technology is used. QQuickWidget takes care
+ of forwarding input events to the underlying Qt Quick scene automatically.
+*/
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/fbitem.cpp
index 139fcbae5c..139fcbae5c 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/fbitem.cpp
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.h b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/fbitem.h
index 573cfd7866..573cfd7866 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.h
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/fbitem.h
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/logo.cpp b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/logo.cpp
index b11c326034..b11c326034 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/logo.cpp
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/logo.cpp
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/logo.h b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/logo.h
index 7e58bbb7b7..7e58bbb7b7 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/logo.h
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/logo.h
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/main.cpp b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/main.cpp
index c0a26eefba..c0a26eefba 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/main.cpp
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/main.cpp
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/mainwindow.cpp
index b393937809..27d320892e 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.cpp
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/mainwindow.cpp
@@ -158,7 +158,7 @@ void MainWindow::updateView()
? m_currentRootObject->property("currentText").toString()
: QStringLiteral("Hello Qt");
- QUrl source("qrc:qquickviewcomparison/test.qml");
+ QUrl source("qrc:qquickwidgetversuswindow_opengl/test.qml");
if (m_state == UseWindow) {
auto *quickView = new QQuickView;
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.h b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/mainwindow.h
index d182b70960..d182b70960 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/mainwindow.h
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/mainwindow.h
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.pro b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/qquickwidgetversuswindow_opengl.pro
index 7809c20b3a..42930b1ecd 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.pro
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/qquickwidgetversuswindow_opengl.pro
@@ -1,5 +1,5 @@
TEMPLATE = app
-TARGET = qquickviewcomparison
+TARGET = qquickwidgetversuswindow_opengl
CONFIG += qmltypes
QML_IMPORT_NAME = fbitem
@@ -16,9 +16,9 @@ HEADERS += mainwindow.h \
logo.h \
fbitem.h
-RESOURCES += qquickviewcomparison.qrc
+RESOURCES += qquickwidgetversuswindow_opengl.qrc
OTHER_FILES += test.qml
-target.path = $$[QT_INSTALL_EXAMPLES]/quick/quickwidgets/qquickviewcomparison
+target.path = $$[QT_INSTALL_EXAMPLES]/quick/quickwidgets/qquickwidgetversuswindow_opengl
INSTALLS += target
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.qrc b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/qquickwidgetversuswindow_opengl.qrc
index e545c993c0..4650ef97e8 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/qquickviewcomparison.qrc
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/qquickwidgetversuswindow_opengl.qrc
@@ -1,5 +1,5 @@
<RCC>
- <qresource prefix="/qquickviewcomparison">
+ <qresource prefix="/qquickwidgetversuswindow_opengl">
<file>test.qml</file>
<file>wobble.frag.qsb</file>
</qresource>
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/test.qml b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/test.qml
index 8224320509..8224320509 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/test.qml
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/test.qml
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/wobble.frag b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/wobble.frag
index 9fddf1a162..9fddf1a162 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/wobble.frag
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/wobble.frag
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/wobble.frag.qsb b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/wobble.frag.qsb
index ab764e8326..ab764e8326 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/wobble.frag.qsb
+++ b/examples/quick/quickwidgets/qquickwidgetversuswindow_opengl/wobble.frag.qsb
Binary files differ
diff --git a/examples/quick/quickwidgets/quickwidget/CMakeLists.txt b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt
index f3cd7688c3..c8121d81a4 100644
--- a/examples/quick/quickwidgets/quickwidget/CMakeLists.txt
+++ b/examples/quick/quickwidgets/quickwidget/CMakeLists.txt
@@ -12,7 +12,6 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quick/quickwidgets/quickwidget")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Quick QuickWidgets Widgets)
qt_add_executable(quickwidget
- fbitem.cpp fbitem.h
main.cpp
)
@@ -33,9 +32,7 @@ qt_add_qml_module(quickwidget
URI QuickWidgetExample
VERSION 1.0
QML_FILES
- customgl.qml
rotatingsquare.qml
- rotatingsquaretab.qml
RESOURCE_PREFIX /quickwidget
NO_RESOURCE_TARGET_PATH
)
diff --git a/examples/quick/quickwidgets/quickwidget/customgl.qml b/examples/quick/quickwidgets/quickwidget/customgl.qml
deleted file mode 100644
index 577f006bd7..0000000000
--- a/examples/quick/quickwidgets/quickwidget/customgl.qml
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-import QuickWidgetExample 1.0
-
-Rectangle {
- color: "lightGray"
-
- FbItem {
- anchors.fill: parent
- anchors.margins: 10
- }
-
- Text {
- anchors.left: parent.left
- anchors.bottom: parent.bottom
- anchors.margins: 15
- text: "QQuickFramebufferObject with animated clear color"
- color: "white"
- }
-}
diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.cpp b/examples/quick/quickwidgets/quickwidget/fbitem.cpp
deleted file mode 100644
index 3e98168dcf..0000000000
--- a/examples/quick/quickwidgets/quickwidget/fbitem.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "fbitem.h"
-#include <QOpenGLFramebufferObject>
-#include <QOpenGLContext>
-#include <QOpenGLFunctions>
-#include <QtCore/QDebug>
-
-#if QT_CONFIG(opengl)
-class FbRenderer : public QQuickFramebufferObject::Renderer
-{
-public:
- FbRenderer() { }
-
- // The lifetime of the FBO and this class depends on how QQuickWidget
- // manages the scenegraph and context when it comes to showing and hiding
- // the widget. The actual behavior is proven by the debug prints.
- ~FbRenderer() override {
- qDebug("FbRenderer destroyed");
- }
-
- void render() override {
- QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
- f->glClearColor(c, 0, 0, 1);
- f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- c += 0.01f * dir;
- if (c >= 1.0f || c <= 0.0f)
- dir *= -1;
- update();
- }
-
- QOpenGLFramebufferObject *createFramebufferObject(const QSize &size) override {
- qDebug() << "Creating FBO" << size;
- QOpenGLFramebufferObjectFormat format;
- format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- return new QOpenGLFramebufferObject(size, format);
- }
-
-private:
- float c = 0;
- int dir = 1;
-};
-#endif
-
-QQuickFramebufferObject::Renderer *FbItem::createRenderer() const
-{
-#if QT_CONFIG(opengl)
- return new FbRenderer;
-#else
- return nullptr;
-#endif
-}
diff --git a/examples/quick/quickwidgets/quickwidget/fbitem.h b/examples/quick/quickwidgets/quickwidget/fbitem.h
deleted file mode 100644
index eb5ec1f1d0..0000000000
--- a/examples/quick/quickwidgets/quickwidget/fbitem.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef FBITEM_H
-#define FBITEM_H
-
-#include <QtQuick/QQuickFramebufferObject>
-
-class FbItem : public QQuickFramebufferObject
-{
- Q_OBJECT
- QML_ELEMENT
-public:
- Renderer *createRenderer() const override;
-};
-
-#endif
diff --git a/examples/quick/quickwidgets/quickwidget/main.cpp b/examples/quick/quickwidgets/quickwidget/main.cpp
index 191adcc451..5d1bc38aa7 100644
--- a/examples/quick/quickwidgets/quickwidget/main.cpp
+++ b/examples/quick/quickwidgets/quickwidget/main.cpp
@@ -48,14 +48,18 @@
**
****************************************************************************/
+#include <QApplication>
+#include <QCommandLineParser>
#include <QQuickWidget>
#include <QQuickItem>
#include <QQmlError>
-#include <QtWidgets>
-#include "fbitem.h"
-
-static bool optMultipleSample = false;
-static bool optCoreProfile = false;
+#include <QMdiArea>
+#include <QLCDNumber>
+#include <QFileDialog>
+#include <QStatusBar>
+#include <QMainWindow>
+#include <QMenuBar>
+#include <QPushButton>
class MainWindow : public QMainWindow {
Q_OBJECT
@@ -74,14 +78,12 @@ private:
QQuickWidget *m_quickWidget;
};
+static bool optMultipleSample = false;
+
MainWindow::MainWindow()
: m_quickWidget(new QQuickWidget)
{
QSurfaceFormat format;
- if (optCoreProfile) {
- format.setVersion(4, 4);
- format.setProfile(QSurfaceFormat::CoreProfile);
- }
if (optMultipleSample)
format.setSamples(4);
m_quickWidget->setFormat(format);
@@ -120,23 +122,45 @@ MainWindow::MainWindow()
void MainWindow::createQuickWidgetsInTabs(QMdiArea *mdiArea)
{
- QTabWidget *tabWidget = new QTabWidget;
+ // A QQuickWidget should work like any other widget when it comes to being
+ // in layouts, in tab widgets, MDI areas, etc. It can also be freely
+ // reparented and made top-level.
+ QTabWidget *tabWidget = new QTabWidget;
const QSize size(400, 400);
-
- QQuickWidget *w = new QQuickWidget;
- w->resize(size);
- w->setResizeMode(QQuickWidget::SizeRootObjectToView);
- w->setSource(QUrl("qrc:quickwidget/rotatingsquaretab.qml"));
-
- tabWidget->addTab(w, tr("Plain Quick content"));
-
- w = new QQuickWidget;
- w->resize(size);
- w->setResizeMode(QQuickWidget::SizeRootObjectToView);
- w->setSource(QUrl("qrc:quickwidget/customgl.qml"));
-
- tabWidget->addTab(w, tr("Custom OpenGL drawing"));
+ const QString msgToTopLevel = QLatin1String("Break out to top-level window");
+ const QString msgFromTopLevel = QLatin1String("Move back under tab widget");
+
+ static const int N = 4;
+ static const QColor colorTab[N] = { Qt::green, Qt::blue, Qt::yellow, Qt::magenta };
+ for (int i = 0; i < N; ++i) {
+ QQuickWidget *widget = new QQuickWidget;
+ widget->resize(size);
+ widget->setResizeMode(QQuickWidget::SizeRootObjectToView);
+ QObject::connect(widget, &QQuickWidget::statusChanged, widget, [widget, i] {
+ if (widget->status() == QQuickWidget::Ready) {
+ if (QQuickItem *rootItem = widget->rootObject()) {
+ rootItem->setProperty("rectColor", colorTab[i]);
+ }
+ }
+ });
+ widget->setSource(QUrl("qrc:quickwidget/rotatingsquare.qml"));
+ widget->setWindowTitle(QString::asprintf("Tab %d", i + 1));
+ QPushButton *btn = new QPushButton(msgToTopLevel, widget);
+ connect(btn, &QPushButton::clicked, widget, [=] {
+ if (widget->parent()) {
+ widget->setAttribute(Qt::WA_DeleteOnClose, true);
+ widget->setParent(nullptr);
+ widget->show();
+ btn->setText(msgFromTopLevel);
+ } else {
+ widget->setAttribute(Qt::WA_DeleteOnClose, false);
+ tabWidget->addTab(widget, widget->windowTitle());
+ btn->setText(msgToTopLevel);
+ }
+ });
+ tabWidget->addTab(widget, QString::asprintf("Tab %d", i + 1));
+ }
mdiArea->addSubWindow(tabWidget);
tabWidget->show();
@@ -197,25 +221,20 @@ int main(int argc, char **argv)
{
QApplication app(argc, argv);
- // this example and QQuickWidget are only functional when rendering with OpenGL
- QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
-
QCoreApplication::setApplicationName("Qt QQuickWidget Example");
QCoreApplication::setOrganizationName("QtProject");
QCoreApplication::setApplicationVersion(QT_VERSION_STR);
+
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::applicationName());
parser.addHelpOption();
parser.addVersionOption();
QCommandLineOption multipleSampleOption("multisample", "Multisampling");
parser.addOption(multipleSampleOption);
- QCommandLineOption coreProfileOption("coreprofile", "Use core profile");
- parser.addOption(coreProfileOption);
parser.process(app);
optMultipleSample = parser.isSet(multipleSampleOption);
- optCoreProfile = parser.isSet(coreProfileOption);
MainWindow mainWindow;
mainWindow.show();
diff --git a/examples/quick/quickwidgets/quickwidget/quickwidget.pro b/examples/quick/quickwidgets/quickwidget/quickwidget.pro
index b824c520f5..9c31ac28f3 100644
--- a/examples/quick/quickwidgets/quickwidget/quickwidget.pro
+++ b/examples/quick/quickwidgets/quickwidget/quickwidget.pro
@@ -7,8 +7,7 @@ CONFIG += qmltypes
QML_IMPORT_NAME = QuickWidgetExample
QML_IMPORT_MAJOR_VERSION = 1
-SOURCES += main.cpp fbitem.cpp
-HEADERS += fbitem.h
+SOURCES += main.cpp
RESOURCES += quickwidget.qrc
diff --git a/examples/quick/quickwidgets/quickwidget/quickwidget.qrc b/examples/quick/quickwidgets/quickwidget/quickwidget.qrc
index 85a49b75ca..c073b7b80d 100644
--- a/examples/quick/quickwidgets/quickwidget/quickwidget.qrc
+++ b/examples/quick/quickwidgets/quickwidget/quickwidget.qrc
@@ -1,7 +1,5 @@
<RCC>
<qresource prefix="/quickwidget">
<file>rotatingsquare.qml</file>
- <file>rotatingsquaretab.qml</file>
- <file>customgl.qml</file>
</qresource>
</RCC>
diff --git a/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml b/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml
index 5d3bb72fbe..08b769d80f 100644
--- a/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml
+++ b/examples/quick/quickwidgets/quickwidget/rotatingsquare.qml
@@ -48,10 +48,11 @@
**
****************************************************************************/
-import QtQuick 2.0
+import QtQuick 2.8
Rectangle {
id: root
+ property color rectColor: "red"
Rectangle {
property int d: 100
@@ -59,13 +60,35 @@ Rectangle {
width: d
height: d
anchors.centerIn: parent
- color: "red"
+ color: root.rectColor
NumberAnimation on rotation { from: 0; to: 360; duration: 2000; loops: Animation.Infinite; }
}
Text {
+ id: text
anchors.centerIn: parent
- text: "Qt Quick running in a widget"
+ property string api
+ Connections {
+ target: text.GraphicsInfo
+ function onApiChanged() {
+ var api = text.GraphicsInfo.api;
+ if (api === GraphicsInfo.Software)
+ text.api = "Software";
+ else if (api === GraphicsInfo.OpenGL)
+ text.api = "OpenGL on QRhi";
+ else if (api === GraphicsInfo.Direct3D11)
+ text.api = "D3D11 on QRhi";
+ else if (api === GraphicsInfo.Vulkan)
+ text.api = "Vulkan on QRhi";
+ else if (api === GraphicsInfo.Metal)
+ text.api = "Metal on QRhi";
+ else if (api === GraphicsInfo.Null)
+ text.api = "Null on QRhi";
+ else
+ text.api = "Unknown API";
+ }
+ }
+ text: "Qt Quick running in a widget\nGraphicsInfo.api says: " + api
}
function performLayerBasedGrab(fn) {
diff --git a/examples/quick/quickwidgets/quickwidget/rotatingsquaretab.qml b/examples/quick/quickwidgets/quickwidget/rotatingsquaretab.qml
deleted file mode 100644
index 116a8f8729..0000000000
--- a/examples/quick/quickwidgets/quickwidget/rotatingsquaretab.qml
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2017 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the examples of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:BSD$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** BSD License Usage
-** Alternatively, you may use this file under the terms of the BSD license
-** as follows:
-**
-** "Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are
-** met:
-** * Redistributions of source code must retain the above copyright
-** notice, this list of conditions and the following disclaimer.
-** * Redistributions in binary form must reproduce the above copyright
-** notice, this list of conditions and the following disclaimer in
-** the documentation and/or other materials provided with the
-** distribution.
-** * Neither the name of The Qt Company Ltd nor the names of its
-** contributors may be used to endorse or promote products derived
-** from this software without specific prior written permission.
-**
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-import QtQuick 2.0
-
-Rectangle {
- gradient: Gradient {
- GradientStop { position: 0; color: "steelblue" }
- GradientStop { position: 1; color: "black" }
- }
-
- Rectangle {
- property int d: 100
- id: square
- width: d
- height: d
- anchors.centerIn: parent
- color: "green"
- NumberAnimation on rotation { from: 360; to: 0; duration: 4000; loops: Animation.Infinite; }
- }
-
- Text {
- anchors.centerIn: parent
- text: "Qt Quick running in a tab widget"
- color: "purple"
- font.bold: true
- font.pointSize: 14
- }
-}
diff --git a/examples/quick/quickwidgets/quickwidgets.pro b/examples/quick/quickwidgets/quickwidgets.pro
index be932f33d0..14d1893776 100644
--- a/examples/quick/quickwidgets/quickwidgets.pro
+++ b/examples/quick/quickwidgets/quickwidgets.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
SUBDIRS = quickwidget \
- qquickviewcomparison
+ qquickwidgetversuswindow_opengl
diff --git a/examples/quick/text/textselection/textselection.qml b/examples/quick/text/textselection/textselection.qml
index 7dcd2c962a..e05e8dca8c 100644
--- a/examples/quick/text/textselection/textselection.qml
+++ b/examples/quick/text/textselection/textselection.qml
@@ -83,8 +83,8 @@ Rectangle {
id: flick
anchors.fill: parent
- contentWidth: edit.paintedWidth
- contentHeight: edit.paintedHeight
+ contentWidth: edit.contentWidth
+ contentHeight: edit.contentHeight
interactive: true
clip: true
diff --git a/examples/quickcontrols2/CMakeLists.txt b/examples/quickcontrols2/CMakeLists.txt
index bca1743245..7a51634790 100644
--- a/examples/quickcontrols2/CMakeLists.txt
+++ b/examples/quickcontrols2/CMakeLists.txt
@@ -1,5 +1,7 @@
qt_internal_add_example(gallery)
-add_subdirectory(chattutorial)
+if (TARGET Qt::Sql)
+ add_subdirectory(chattutorial)
+endif()
if (QT_FEATURE_quicktemplates2_calendar AND TARGET Qt::Sql)
qt_internal_add_example(eventcalendar)
endif()