aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/demos/photosurface/main.cpp8
-rw-r--r--examples/quick/demos/samegame/content/qmldir1
-rw-r--r--examples/quick/demos/samegame/samegame.qrc2
-rw-r--r--examples/quick/embeddedinwidgets/main.cpp3
-rw-r--r--examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp4
-rw-r--r--examples/quick/quickwidgets/quickwidget/main.cpp3
-rw-r--r--examples/quick/rendercontrol/cuberenderer.cpp4
-rw-r--r--examples/quick/rendercontrol/window_multithreaded.cpp8
-rw-r--r--examples/quick/rendercontrol/window_singlethreaded.cpp8
-rw-r--r--examples/quick/scenegraph/openglunderqml/squircle.cpp32
-rw-r--r--examples/quick/scenegraph/rendernode/openglrenderer.cpp4
-rw-r--r--examples/quick/scenegraph/sgengine/window.cpp2
-rw-r--r--examples/quick/scenegraph/shared/logorenderer.cpp8
-rw-r--r--examples/quick/scenegraph/textureinthread/main.cpp2
-rw-r--r--examples/quick/shared/Label.qml (renamed from examples/quick/demos/samegame/content/+blackberry/Settings.qml)11
-rw-r--r--examples/quick/shared/quick_shared.qrc1
-rw-r--r--examples/quick/shared/shared.qrc1
-rw-r--r--examples/quick/window/AllScreens.qml (renamed from examples/quick/demos/samegame/content/BBSettings.qml)46
-rw-r--r--examples/quick/window/CurrentScreen.qml (renamed from examples/quick/window/ScreenInfo.qml)43
-rw-r--r--examples/quick/window/Splash.qml2
-rw-r--r--examples/quick/window/doc/src/window.qdoc2
-rw-r--r--examples/quick/window/main.cpp3
-rw-r--r--examples/quick/window/window.qml23
-rw-r--r--examples/quick/window/window.qrc3
24 files changed, 127 insertions, 97 deletions
diff --git a/examples/quick/demos/photosurface/main.cpp b/examples/quick/demos/photosurface/main.cpp
index 9456694032..b9d093df40 100644
--- a/examples/quick/demos/photosurface/main.cpp
+++ b/examples/quick/demos/photosurface/main.cpp
@@ -59,9 +59,11 @@ static QStringList imageNameFilters()
{
QStringList result;
QMimeDatabase mimeDatabase;
- foreach (const QByteArray &m, QImageReader::supportedMimeTypes()) {
- foreach (const QString &suffix, mimeDatabase.mimeTypeForName(m).suffixes())
- result.append(QStringLiteral("*.") + suffix);
+ const auto supportedMimeTypes = QImageReader::supportedMimeTypes();
+ for (const QByteArray &m : supportedMimeTypes) {
+ const auto suffixes = mimeDatabase.mimeTypeForName(m).suffixes();
+ for (const QString &suffix : suffixes)
+ result.append(QLatin1String("*.") + suffix);
}
return result;
}
diff --git a/examples/quick/demos/samegame/content/qmldir b/examples/quick/demos/samegame/content/qmldir
index 727989d006..3b552ec1f1 100644
--- a/examples/quick/demos/samegame/content/qmldir
+++ b/examples/quick/demos/samegame/content/qmldir
@@ -1,5 +1,4 @@
singleton Settings 1.0 Settings.qml
-BBSettings 1.0 BBSettings.qml
Block 1.0 Block.qml
BlockEmitter 1.0 BlockEmitter.qml
Button 1.0 Button.qml
diff --git a/examples/quick/demos/samegame/samegame.qrc b/examples/quick/demos/samegame/samegame.qrc
index e51d3fae05..348ee109f9 100644
--- a/examples/quick/demos/samegame/samegame.qrc
+++ b/examples/quick/demos/samegame/samegame.qrc
@@ -3,8 +3,6 @@
<file>samegame.qml</file>
<file>content/qmldir</file>
<file>content/Settings.qml</file>
- <file>content/BBSettings.qml</file>
- <file>content/+blackberry/Settings.qml</file>
<file>content/gfx/text-p1-won.png</file>
<file>content/gfx/background-puzzle.png</file>
<file>content/gfx/background.png</file>
diff --git a/examples/quick/embeddedinwidgets/main.cpp b/examples/quick/embeddedinwidgets/main.cpp
index 96b0df7e13..91147772ba 100644
--- a/examples/quick/embeddedinwidgets/main.cpp
+++ b/examples/quick/embeddedinwidgets/main.cpp
@@ -103,7 +103,8 @@ void MainWindow::quickViewStatusChanged(QQuickView::Status status)
{
if (status == QQuickView::Error) {
QStringList errors;
- foreach (const QQmlError &error, m_quickView->errors())
+ const auto viewErrors = m_quickView->errors();
+ for (const QQmlError &error : viewErrors)
errors.append(error.toString());
statusBar()->showMessage(errors.join(QStringLiteral(", ")));
}
diff --git a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp
index c5924bf159..49c4450b89 100644
--- a/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp
+++ b/examples/quick/quickwidgets/qquickviewcomparison/fbitem.cpp
@@ -263,8 +263,8 @@ static const char *fragmentShaderSource =
void FbItemRenderer::initProgram()
{
m_program.reset(new QOpenGLShaderProgram);
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource);
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource);
m_program->bindAttributeLocation("vertex", 0);
m_program->bindAttributeLocation("normal", 1);
m_program->link();
diff --git a/examples/quick/quickwidgets/quickwidget/main.cpp b/examples/quick/quickwidgets/quickwidget/main.cpp
index 6bb6722e02..7cb35d7bcd 100644
--- a/examples/quick/quickwidgets/quickwidget/main.cpp
+++ b/examples/quick/quickwidgets/quickwidget/main.cpp
@@ -133,7 +133,8 @@ void MainWindow::quickWidgetStatusChanged(QQuickWidget::Status status)
{
if (status == QQuickWidget::Error) {
QStringList errors;
- foreach (const QQmlError &error, m_quickWidget->errors())
+ const auto widgetErrors = m_quickWidget->errors();
+ for (const QQmlError &error : widgetErrors)
errors.append(error.toString());
statusBar()->showMessage(errors.join(QStringLiteral(", ")));
}
diff --git a/examples/quick/rendercontrol/cuberenderer.cpp b/examples/quick/rendercontrol/cuberenderer.cpp
index 1b2d7dec8f..4651882542 100644
--- a/examples/quick/rendercontrol/cuberenderer.cpp
+++ b/examples/quick/rendercontrol/cuberenderer.cpp
@@ -101,8 +101,8 @@ void CubeRenderer::init(QWindow *w, QOpenGLContext *share)
" gl_FragColor = vec4(texture2D(sampler, v_coord).rgb, 1.0);\n"
"}\n";
m_program = new QOpenGLShaderProgram;
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource);
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource);
m_program->bindAttributeLocation("vertex", 0);
m_program->bindAttributeLocation("coord", 1);
m_program->link();
diff --git a/examples/quick/rendercontrol/window_multithreaded.cpp b/examples/quick/rendercontrol/window_multithreaded.cpp
index 4df3488ab3..013ee7c208 100644
--- a/examples/quick/rendercontrol/window_multithreaded.cpp
+++ b/examples/quick/rendercontrol/window_multithreaded.cpp
@@ -356,16 +356,16 @@ void WindowMultiThreaded::run()
disconnect(m_qmlComponent, &QQmlComponent::statusChanged, this, &WindowMultiThreaded::run);
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
QObject *rootObject = m_qmlComponent->create();
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
diff --git a/examples/quick/rendercontrol/window_singlethreaded.cpp b/examples/quick/rendercontrol/window_singlethreaded.cpp
index 45f2635ca4..ef8f2fed43 100644
--- a/examples/quick/rendercontrol/window_singlethreaded.cpp
+++ b/examples/quick/rendercontrol/window_singlethreaded.cpp
@@ -209,16 +209,16 @@ void WindowSingleThreaded::run()
disconnect(m_qmlComponent, &QQmlComponent::statusChanged, this, &WindowSingleThreaded::run);
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
QObject *rootObject = m_qmlComponent->create();
if (m_qmlComponent->isError()) {
- QList<QQmlError> errorList = m_qmlComponent->errors();
- foreach (const QQmlError &error, errorList)
+ const QList<QQmlError> errorList = m_qmlComponent->errors();
+ for (const QQmlError &error : errorList)
qWarning() << error.url() << error.line() << error;
return;
}
diff --git a/examples/quick/scenegraph/openglunderqml/squircle.cpp b/examples/quick/scenegraph/openglunderqml/squircle.cpp
index 6b25756e61..b7082892b8 100644
--- a/examples/quick/scenegraph/openglunderqml/squircle.cpp
+++ b/examples/quick/scenegraph/openglunderqml/squircle.cpp
@@ -125,22 +125,22 @@ void SquircleRenderer::paint()
initializeOpenGLFunctions();
m_program = new QOpenGLShaderProgram();
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex,
- "attribute highp vec4 vertices;"
- "varying highp vec2 coords;"
- "void main() {"
- " gl_Position = vertices;"
- " coords = vertices.xy;"
- "}");
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment,
- "uniform lowp float t;"
- "varying highp vec2 coords;"
- "void main() {"
- " lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));"
- " i = smoothstep(t - 0.8, t + 0.8, i);"
- " i = floor(i * 20.) / 20.;"
- " gl_FragColor = vec4(coords * .5 + .5, i, i);"
- "}");
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex,
+ "attribute highp vec4 vertices;"
+ "varying highp vec2 coords;"
+ "void main() {"
+ " gl_Position = vertices;"
+ " coords = vertices.xy;"
+ "}");
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment,
+ "uniform lowp float t;"
+ "varying highp vec2 coords;"
+ "void main() {"
+ " lowp float i = 1. - (pow(abs(coords.x), 4.) + pow(abs(coords.y), 4.));"
+ " i = smoothstep(t - 0.8, t + 0.8, i);"
+ " i = floor(i * 20.) / 20.;"
+ " gl_FragColor = vec4(coords * .5 + .5, i, i);"
+ "}");
m_program->bindAttributeLocation("vertices", 0);
m_program->link();
diff --git a/examples/quick/scenegraph/rendernode/openglrenderer.cpp b/examples/quick/scenegraph/rendernode/openglrenderer.cpp
index 65c2a210bc..c84867797d 100644
--- a/examples/quick/scenegraph/rendernode/openglrenderer.cpp
+++ b/examples/quick/scenegraph/rendernode/openglrenderer.cpp
@@ -86,8 +86,8 @@ void OpenGLRenderNode::init()
" gl_FragColor = col * opacity;\n"
"}\n";
- m_program->addShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
- m_program->addShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource);
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vertexShaderSource);
+ m_program->addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fragmentShaderSource);
m_program->bindAttributeLocation("posAttr", 0);
m_program->bindAttributeLocation("colAttr", 1);
m_program->link();
diff --git a/examples/quick/scenegraph/sgengine/window.cpp b/examples/quick/scenegraph/sgengine/window.cpp
index 2e4a70d2af..759bbf1fcd 100644
--- a/examples/quick/scenegraph/sgengine/window.cpp
+++ b/examples/quick/scenegraph/sgengine/window.cpp
@@ -187,7 +187,7 @@ void Window::update()
void Window::sync()
{
QList<QSharedPointer<Item> > validItems;
- foreach (QSharedPointer<Item> item, m_items) {
+ for (QSharedPointer<Item> item : qAsConst(m_items)) {
if (!item->isDone()) {
validItems.append(item);
item->sync();
diff --git a/examples/quick/scenegraph/shared/logorenderer.cpp b/examples/quick/scenegraph/shared/logorenderer.cpp
index 06f4892a49..8eb2d44c1e 100644
--- a/examples/quick/scenegraph/shared/logorenderer.cpp
+++ b/examples/quick/scenegraph/shared/logorenderer.cpp
@@ -70,7 +70,6 @@ void LogoRenderer::initialize()
glClearColor(0.1f, 0.1f, 0.2f, 1.0f);
- QOpenGLShader *vshader1 = new QOpenGLShader(QOpenGLShader::Vertex, &program1);
const char *vsrc1 =
"attribute highp vec4 vertex;\n"
"attribute mediump vec3 normal;\n"
@@ -85,19 +84,16 @@ void LogoRenderer::initialize()
" color = clamp(color, 0.0, 1.0);\n"
" gl_Position = matrix * vertex;\n"
"}\n";
- vshader1->compileSourceCode(vsrc1);
- QOpenGLShader *fshader1 = new QOpenGLShader(QOpenGLShader::Fragment, &program1);
const char *fsrc1 =
"varying mediump vec4 color;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = color;\n"
"}\n";
- fshader1->compileSourceCode(fsrc1);
- program1.addShader(vshader1);
- program1.addShader(fshader1);
+ program1.addCacheableShaderFromSourceCode(QOpenGLShader::Vertex, vsrc1);
+ program1.addCacheableShaderFromSourceCode(QOpenGLShader::Fragment, fsrc1);
program1.link();
vertexAttr1 = program1.attributeLocation("vertex");
diff --git a/examples/quick/scenegraph/textureinthread/main.cpp b/examples/quick/scenegraph/textureinthread/main.cpp
index 22550cd22b..61d1c5e6dc 100644
--- a/examples/quick/scenegraph/textureinthread/main.cpp
+++ b/examples/quick/scenegraph/textureinthread/main.cpp
@@ -82,7 +82,7 @@ int main(int argc, char **argv)
// As the render threads make use of our QGuiApplication object
// to clean up gracefully, wait for them to finish before
// QGuiApp is taken off the heap.
- foreach (QThread *t, ThreadRenderer::threads) {
+ for (QThread *t : qAsConst(ThreadRenderer::threads)) {
t->wait();
delete t;
}
diff --git a/examples/quick/demos/samegame/content/+blackberry/Settings.qml b/examples/quick/shared/Label.qml
index c744ca6f51..ea4bef5415 100644
--- a/examples/quick/demos/samegame/content/+blackberry/Settings.qml
+++ b/examples/quick/shared/Label.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -38,10 +38,9 @@
**
****************************************************************************/
-pragma Singleton
-import QtQml 2.0
+import QtQuick 2.0
-// Instantiating a BBSettings class that can be easily tweaked for future
-// BB devices (we may have more selectors added)
-BBSettings {
+Text {
+ SystemPalette { id: palette }
+ color: palette.text
}
diff --git a/examples/quick/shared/quick_shared.qrc b/examples/quick/shared/quick_shared.qrc
index ea7e0fdd89..21f393a64d 100644
--- a/examples/quick/shared/quick_shared.qrc
+++ b/examples/quick/shared/quick_shared.qrc
@@ -4,6 +4,7 @@
<file>SimpleLauncherDelegate.qml</file>
<file>Button.qml</file>
<file>CheckBox.qml</file>
+ <file>Label.qml</file>
<file>TextField.qml</file>
<file>images/back.png</file>
<file>images/next.png</file>
diff --git a/examples/quick/shared/shared.qrc b/examples/quick/shared/shared.qrc
index 7e0c66c34b..89b3ff757e 100644
--- a/examples/quick/shared/shared.qrc
+++ b/examples/quick/shared/shared.qrc
@@ -6,6 +6,7 @@
<file>Slider.qml</file>
<file>images/slider_handle.png</file>
<file>CheckBox.qml</file>
+ <file>Label.qml</file>
<file>TabSet.qml</file>
<file>TextField.qml</file>
<file>images/back.png</file>
diff --git a/examples/quick/demos/samegame/content/BBSettings.qml b/examples/quick/window/AllScreens.qml
index cd6be7dcf5..83a6c5f958 100644
--- a/examples/quick/demos/samegame/content/BBSettings.qml
+++ b/examples/quick/window/AllScreens.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2013 BlackBerry Limited. All rights reserved.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -38,24 +38,38 @@
**
****************************************************************************/
-import QtQml 2.0
+import QtQuick 2.3
+import QtQuick.Window 2.3
+import "../shared" as Shared
-QtObject {
- // This height/width is here for desktop testing, otherwise
- // we could just use Screen.width/Screen.height.
- property int screenHeight: 1280
- property int screenWidth: 768
+Column {
+ id: root
+ spacing: 8
- property int menuDelay: 500
+ Shared.Label {
+ text: "Total number of screens: " + screenInfo.count
+ font.bold: true
+ }
- property int headerHeight: 70
- property int footerHeight: 100
+ Flow {
+ spacing: 12
+ width: parent.width
- property int fontPixelSize: 55
+ Repeater {
+ id: screenInfo
+ model: Qt.application.screens
+ Shared.Label {
+ lineHeight: 1.5
+ text: name + "\n" + virtualX + ", " + virtualY + " " + modelData.width + "x" + modelData.height
+ }
+ }
+ }
- property int blockSize: 64
-
- property int toolButtonHeight: 64
-
- property int menuButtonSpacing: 15
+ Component.onCompleted: {
+ var screens = Qt.application.screens;
+ for (var i = 0; i < screens.length; ++i)
+ console.log("screen " + screens[i].name + " has geometry " +
+ screens[i].virtualX + ", " + screens[i].virtualY + " " +
+ screens[i].width + "x" + screens[i].height)
+ }
}
diff --git a/examples/quick/window/ScreenInfo.qml b/examples/quick/window/CurrentScreen.qml
index ee0a31c794..09fbce9a74 100644
--- a/examples/quick/window/ScreenInfo.qml
+++ b/examples/quick/window/CurrentScreen.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -40,6 +40,7 @@
import QtQuick 2.3
import QtQuick.Window 2.1
+import "../shared" as Shared
Item {
id: root
@@ -70,32 +71,42 @@ Item {
y: spacing
//! [screen]
- Text {
+ Shared.Label {
text: "Screen \"" + Screen.name + "\":"
font.bold: true
}
Item { width: 1; height: 1 } // spacer
- Text { text: "dimensions" }
- Text { text: Screen.width + "x" + Screen.height }
+ Shared.Label { text: "dimensions" }
+ Shared.Label { text: Screen.width + "x" + Screen.height }
- Text { text: "pixel density" }
- Text { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" }
+ Shared.Label { text: "pixel density" }
+ Shared.Label { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" }
- Text { text: "logical pixel density" }
- Text { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" }
+ Shared.Label { text: "logical pixel density" }
+ Shared.Label { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" }
- Text { text: "device pixel ratio" }
- Text { text: Screen.devicePixelRatio.toFixed(2) }
+ Shared.Label { text: "device pixel ratio" }
+ Shared.Label { text: Screen.devicePixelRatio.toFixed(2) }
- Text { text: "available virtual desktop" }
- Text { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }
+ Shared.Label { text: "available virtual desktop" }
+ Shared.Label { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight }
- Text { text: "orientation" }
- Text { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" }
+ Shared.Label { text: "position in virtual desktop" }
+ Shared.Label { text: Screen.virtualX + ", " + Screen.virtualY }
- Text { text: "primary orientation" }
- Text { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" }
+ Shared.Label { text: "orientation" }
+ Shared.Label { text: orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" }
+
+ Shared.Label { text: "primary orientation" }
+ Shared.Label { text: orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" }
//! [screen]
+
+ Shared.Label { text: "10mm rectangle" }
+ Rectangle {
+ color: "red"
+ width: Screen.pixelDensity * 10
+ height: width
+ }
}
}
diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml
index 083c3babc8..3baf207992 100644
--- a/examples/quick/window/Splash.qml
+++ b/examples/quick/window/Splash.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
diff --git a/examples/quick/window/doc/src/window.qdoc b/examples/quick/window/doc/src/window.qdoc
index 5cd51beceb..2028b31383 100644
--- a/examples/quick/window/doc/src/window.qdoc
+++ b/examples/quick/window/doc/src/window.qdoc
@@ -73,7 +73,7 @@
\l Screen has several properties which are generally useful to
applications which need to rotate some content when the screen orientation
changes, to position windows on the screen or to convert real units to
- logical pixel units. ScreenInfo.qml (which is displayed inline in
+ logical pixel units. CurrentScreen.qml (which is displayed inline in
window.qml, or can be run by itself with qmlscene) simply displays the
property values, while the splash screen uses them to center the window on
the screen.
diff --git a/examples/quick/window/main.cpp b/examples/quick/window/main.cpp
index bacf52af15..ee8855cbc8 100644
--- a/examples/quick/window/main.cpp
+++ b/examples/quick/window/main.cpp
@@ -49,7 +49,8 @@
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
- foreach (QScreen * screen, QGuiApplication::screens())
+ const auto screens = QGuiApplication::screens();
+ for (QScreen *screen : screens)
screen->setOrientationUpdateMask(Qt::LandscapeOrientation | Qt::PortraitOrientation |
Qt::InvertedLandscapeOrientation | Qt::InvertedPortraitOrientation);
QQmlEngine engine;
diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml
index d50bce61b3..d27ab3d0a3 100644
--- a/examples/quick/window/window.qml
+++ b/examples/quick/window/window.qml
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2016 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -39,7 +39,7 @@
****************************************************************************/
import QtQuick 2.0
-import QtQuick.Window 2.1
+import QtQuick.Window 2.3
import "../shared" as Shared
QtObject {
@@ -47,7 +47,7 @@ QtObject {
property SystemPalette palette: SystemPalette { }
property var controlWindow: Window {
- width: visibilityLabel.implicitWidth * 1.2
+ width: col.implicitWidth + defaultSpacing * 2
height: col.implicitHeight + defaultSpacing * 2
color: palette.window
title: "Control Window"
@@ -57,7 +57,7 @@ QtObject {
anchors.margins: defaultSpacing
spacing: defaultSpacing
property real cellWidth: col.width / 3 - spacing
- Text { text: "Control the second window:" }
+ Shared.Label { text: "Control the second window:" }
Grid {
id: grid
columns: 3
@@ -121,18 +121,23 @@ QtObject {
}
return "unknown";
}
- Text {
+ Shared.Label {
id: visibilityLabel
text: "second window is " + (testWindow.visible ? "visible" : "invisible") +
" and has visibility " + parent.visibilityToString(testWindow.visibility)
}
Rectangle {
- id: horizontalRule
- color: "black"
+ color: palette.text
width: parent.width
height: 1
}
- ScreenInfo { }
+ CurrentScreen { }
+ Rectangle {
+ color: palette.text
+ width: parent.width
+ height: 1
+ }
+ AllScreens { width: parent.width }
}
}
@@ -145,7 +150,7 @@ QtObject {
Rectangle {
anchors.fill: parent
anchors.margins: defaultSpacing
- Text {
+ Shared.Label {
anchors.centerIn: parent
text: "Second Window"
}
diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc
index dc211bdaaf..89d1de1b1f 100644
--- a/examples/quick/window/window.qrc
+++ b/examples/quick/window/window.qrc
@@ -2,6 +2,7 @@
<qresource prefix="/window">
<file>window.qml</file>
<file>Splash.qml</file>
- <file>ScreenInfo.qml</file>
+ <file>CurrentScreen.qml</file>
+ <file>AllScreens.qml</file>
</qresource>
</RCC>