diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-05-31 13:48:17 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-05-31 13:48:36 +0200 |
commit | 7e73dc01f85355e23a4ee07c0b624b253541acdc (patch) | |
tree | a59b33bfbc2b11d72e9a12324c105bf7a367eec9 /src | |
parent | e171d1e8c4b4324374cb57a6d7d181a57fc17dbe (diff) | |
parent | e840b9e2c56a786ef7c4232b8fb2f1df1b285da4 (diff) |
Merge remote-tracking branch 'origin/release' into stable
Change-Id: Ie4ce4c3e64f093eec26754e06199d350a46ae2a2
Diffstat (limited to 'src')
23 files changed, 245 insertions, 70 deletions
diff --git a/src/imports/dialogs/dialogs.pro b/src/imports/dialogs/dialogs.pro index b7704dadda..53cad30cee 100644 --- a/src/imports/dialogs/dialogs.pro +++ b/src/imports/dialogs/dialogs.pro @@ -3,6 +3,8 @@ TARGET = dialogplugin TARGETPATH = QtQuick/Dialogs IMPORT_VERSION = 1.0 +QMAKE_DOCS = $$PWD/doc/qtquickdialogs.qdocconf + SOURCES += \ qquickabstractfiledialog.cpp \ qquickplatformfiledialog.cpp \ diff --git a/src/imports/dialogs/doc/qtquickdialogs.qdocconf b/src/imports/dialogs/doc/qtquickdialogs.qdocconf new file mode 100644 index 0000000000..5caa1c0588 --- /dev/null +++ b/src/imports/dialogs/doc/qtquickdialogs.qdocconf @@ -0,0 +1,37 @@ +include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) + +project = QtQuickDialogs +description = Qt Quick Dialogs Reference Documentation +url = http://qt-project.org/doc/qt-$QT_VER/qtquickdialogs/ +version = $QT_VERSION + +qhp.projects = QtQuickDialogs + +qhp.QtQuickDialogs.file = qtquickdialogs.qhp +qhp.QtQuickDialogs.namespace = org.qt-project.qtquickdialogs.$QT_VERSION_TAG +qhp.QtQuickDialogs.virtualFolder = qtquickdialogs +qhp.QtQuickDialogs.indexTitle = Qt Quick Dialogs +qhp.QtQuickDialogs.indexRoot = + +qhp.QtQuickDialogs.filterAttributes = qtquickdialogs $QT_VERSION qtrefdoc +qhp.QtQuickDialogs.customFilters.Qt.name = QtQuickDialogs $QT_VERSION +qhp.QtQuickDialogs.customFilters.Qt.filterAttributes = qtquickdialogs $QT_VERSION + +qhp.QtQuickDialogs.subprojects = qtquickdialogsqmltypes +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.title = QML Types +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.indexTitle = Qt Quick Dialogs +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.selectors = fake:qmlclass +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.sortPages = true +qhp.QtQuickDialogs.subprojects.qtquickdialogsqmltypes.type = manual + +depends = qtqml qtquick qtgui qtwidgets qtdoc + +exampledirs += ../../../../examples/quick/dialogs + +examplesinstallpath = quick/dialogs + +headerdirs += .. + +sourcedirs += .. + +imagedirs += images diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc new file mode 100644 index 0000000000..ee277f48dc --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-examples.qdoc @@ -0,0 +1,36 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group qtquickdialog_examples + \ingroup qtquickexamples + \title Qt Quick Examples - Dialogs + \brief A Collection of examples for \l{Qt Quick Dialogs}, written in QML. + + These examples show how to use the \l{Qt Quick Dialogs}. +*/ + diff --git a/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc new file mode 100644 index 0000000000..5a1223b04d --- /dev/null +++ b/src/imports/dialogs/doc/src/qtquickdialogs-index.qdoc @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** 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 Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/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: http://www.gnu.org/copyleft/fdl.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \group dialogs + \title Dialogs +*/ + +/*! + \page qtquickdialogs-index.html + \title Qt Quick Dialogs + + \brief Qt Quick Dialogs submodule + + The module is new in Qt 5.1. + + \section1 Dialogs + + \annotatedlist dialogs + + \section1 Related information + + \section2 Examples + \list + \li \l{Qt Quick Examples - Dialogs}{Dialogs Examples} + \endlist + + \section2 Reference + \list + \li \l{Qt Quick Dialogs QML Types}{QML Types} + \endlist + +*/ + diff --git a/src/imports/dialogs/plugin.cpp b/src/imports/dialogs/plugin.cpp index bee0ee00bc..5502a65310 100644 --- a/src/imports/dialogs/plugin.cpp +++ b/src/imports/dialogs/plugin.cpp @@ -55,33 +55,6 @@ QT_BEGIN_NAMESPACE - -/*! - \group dialogs - \title Dialogs -*/ - -/*! - \page qtquickdialogs-index.html - \title Qt Quick Dialogs - - \brief Qt Quick Dialogs submodule - - The submodule is new in Qt 5.1. - - \section1 Dialogs - - \annotatedlist dialogs - - \section1 Related information - - \section2 Reference - \list - \li \l{Qt Quick Dialogs QML Types}{Qt Quick Dialogs QML Types} - \endlist - -*/ - /*! \qmlmodule QtQuick.Dialogs 1 \title Qt Quick Dialogs QML Types diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml index 7584241ca6..0bec4cddf2 100644 --- a/src/imports/testlib/TestCase.qml +++ b/src/imports/testlib/TestCase.qml @@ -291,6 +291,11 @@ Item { } function tryCompare(obj, prop, value, timeout) { + if (arguments.length == 2) { + qtest_results.fail("A value is required for tryCompare", + util.callerFile(), util.callerLine()) + throw new Error("QtQuickTest::fail") + } if (!timeout) timeout = 5000 if (!qtest_compareInternal(obj[prop], value)) diff --git a/src/plugins/accessible/quick/qaccessiblequickview.cpp b/src/plugins/accessible/quick/qaccessiblequickview.cpp index b85f23c48b..1240b2ef4c 100644 --- a/src/plugins/accessible/quick/qaccessiblequickview.cpp +++ b/src/plugins/accessible/quick/qaccessiblequickview.cpp @@ -81,10 +81,8 @@ QAccessibleInterface *QAccessibleQuickWindow::parent() const QAccessibleInterface *QAccessibleQuickWindow::child(int index) const { - if (index == 0) { - if (QQuickItem *declarativeRoot = rootItem()) - return new QAccessibleQuickItem(declarativeRoot); - } + if (index == 0) + return QAccessible::queryAccessibleInterface(rootItem()); return 0; } diff --git a/src/qml/animations/qsequentialanimationgroupjob.cpp b/src/qml/animations/qsequentialanimationgroupjob.cpp index c649370680..b82e1850f7 100644 --- a/src/qml/animations/qsequentialanimationgroupjob.cpp +++ b/src/qml/animations/qsequentialanimationgroupjob.cpp @@ -226,14 +226,14 @@ void QSequentialAnimationGroupJob::updateCurrentTime(int currentTime) if (atEnd()) { //we make sure that we don't exceed the duration here m_currentTime += m_currentAnimation->currentTime() - newCurrentTime; - stop(); + RETURN_IF_DELETED(stop()); } } else { //the only case where currentAnimation could be null //is when all animations have been removed Q_ASSERT(!firstChild()); m_currentTime = 0; - stop(); + RETURN_IF_DELETED(stop()); } m_previousLoop = m_currentLoop; diff --git a/src/qml/doc/src/whatsnew.qdoc b/src/qml/doc/src/whatsnew.qdoc index 6ca979db37..38713a1976 100644 --- a/src/qml/doc/src/whatsnew.qdoc +++ b/src/qml/doc/src/whatsnew.qdoc @@ -29,7 +29,28 @@ \title Qt QML Release Notes \page qtqml-releasenotes.html -\section1 Qt QML in Qt 5 +\section1 Qt QML in Qt 5.1 + +Qt 5.1 introduces several bug fixes and new functionalities to Qt QML. This is +a summary of the new changes: +\list +\li New QQmlApplicationEngine convenience class for QML applications. +\li New Instantiatior type for generic, dynamic object creation. +\li New properties for \l Qt.application: arguments, name, and version. +\endlist + +\section2 New Submodules + +The Qt QML Models is a new submodule in Qt 5.1 and provides several QML types +for handling data with models and lists. + +\list +\li \l{QtQml.Models}{Models} +\endlist + +The \l{What's New in Qt 5.1} has more information about the Qt 5.1 release. + +\section1 Qt QML in Qt 5.0 The \l{Qt QML} module is new in Qt 5.0. It provides the QML engine and implements the QML language supporting infrastructure. diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp index 9277b6ea8f..5ddc0f52bd 100644 --- a/src/qml/types/qqmllistmodel.cpp +++ b/src/qml/types/qqmllistmodel.cpp @@ -1431,7 +1431,9 @@ QQmlListModelParser::ListInstruction *QQmlListModelParser::ListModelData::instru The ListModel is a simple container of ListElement definitions, each containing data roles. The contents can be defined dynamically, or explicitly in QML. - This type is also available in the \c {QtQuick 2} import. For full documentation, see \l QtQuick2::ListModel + This type is also available in the \c {QtQuick 2} import. + + \sa {QtQml2::ListModel}{Full documentation for ListModel} */ /*! \qmltype ListModel @@ -2540,7 +2542,9 @@ bool QQmlListModelParser::definesEmptyList(const QString &s) List elements are defined inside ListModel definitions, and represent items in a list. - This type is also available in the \c {QtQuick 2} import. For full documentation, see \l QtQuick2::ListElement + This type is also available in the \c {QtQuick 2} import. + + \sa {QtQml2::ListElement}{Full documentation for ListElement} */ /*! \qmltype ListElement diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf index fba4ff89df..a27b0f82f7 100644 --- a/src/quick/doc/qtquick.qdocconf +++ b/src/quick/doc/qtquick.qdocconf @@ -34,7 +34,7 @@ qhp.QtQuick.subprojects.examples.selectors = fake:example tagfile = ../../../doc/qtquick/qtquick.tags -depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtdoc +depends += qtcore qtxmlpatterns qtqml qtgui qtlinguist qtquickcontrols qtquicklayouts qtdoc qtquickdialogs headerdirs += .. @@ -58,3 +58,6 @@ sourcedirs += ../../imports #add plugins directory because of dependencies headerdirs += ../../plugins sourcedirs += ../../plugins + +#exclude certain directories +excludedirs = ../../imports/dialogs diff --git a/src/quick/doc/src/concepts/positioning/layouts.qdoc b/src/quick/doc/src/concepts/positioning/layouts.qdoc index 785bcc6ca6..35be2f6235 100644 --- a/src/quick/doc/src/concepts/positioning/layouts.qdoc +++ b/src/quick/doc/src/concepts/positioning/layouts.qdoc @@ -28,9 +28,9 @@ /*! \ingroup qtquick-positioners \page qtquick-positioning-layouts.html -\title Item Layouts +\title Item Positioners -Positioner items are container items that manage the positions and sizes of +Positioner items are container items that manage the positions of items in a declarative user interface. Positioners behave in a similar way to the \l{Widgets and Layouts}{layout managers} used with standard Qt widgets, except that they are also containers in their own right. @@ -38,6 +38,10 @@ except that they are also containers in their own right. Positioners make it easier to work with many items when they need to be arranged in a regular layout. +\l{Qt Quick Layouts} can also be used to arrange Qt Quick items in a user interface. +They manage both the positions and the sizes of items on a declarative user interface, +and are well suited for resizable user interfaces. + \section1 Positioners A set of standard positioners are provided in the basic set of Qt Quick diff --git a/src/quick/doc/src/concepts/positioning/topic.qdoc b/src/quick/doc/src/concepts/positioning/topic.qdoc index 25fc6eaab7..bae6a7f71b 100644 --- a/src/quick/doc/src/concepts/positioning/topic.qdoc +++ b/src/quick/doc/src/concepts/positioning/topic.qdoc @@ -34,7 +34,7 @@ Visual items in QML can be positioned in a variety of ways. The most important positioning-related concept is that of anchoring, a form of relative positioning where items can be anchored (or attached) to each other at certain boundaries. Other positioning concepts include absolute positioning, -positioning with coordinate bindings, and layouts. +positioning with coordinate bindings, positioners, and layouts. \section1 Manual Positioning @@ -134,21 +134,20 @@ positioning, whereas a "contaminated" anchor layout is one which uses both anchoring and bindings (either on position-related [x,y] properties or on dimension-related [width,height] properties) to determine the position. -\section1 Layouts - -Qt Quick also provides some built-in layout items. For many use cases, the -best layout to use is a simple grid, row, or column, and Qt Quick provides -items which will layout children in these formations in the most efficient -manner possible. +\section1 Positioners -There are many well-known layouts which work well in user-interfaces, such as -grids and lists, rows and columns. Qt Quick supports these sort of pre-defined -layouts, which can often be more performant to draw than anchor or -binding-based layouts. See the documentation on -\l{qtquick-positioning-layouts.html}{layout types} for more -information about utilizing pre-defined layouts. +Qt Quick also provides some built-in positioner items. For many use cases, the best +positioner to use is a simple grid, row, or column, and Qt Quick provides items which +will position children in these formations in the most efficient manner possible. +See the documentation on \l{qtquick-positioning-layouts.html}{item positioners types} +for more information about utilizing pre-defined positioners. +\section1 Layouts +From Qt 5.1, the module \l {Qt Quick Layouts} can also be used to arrange Qt Quick +items in a user interface. Unlike positioners, the types in Qt Quick Layouts manage +both the positions and sizes of items in a declarative interface. They are well +suited for resizable user interfaces. \section1 Right-To-Left Support diff --git a/src/quick/doc/src/qmltypereference.qdoc b/src/quick/doc/src/qmltypereference.qdoc index d580ba8c96..bb488ac2f2 100644 --- a/src/quick/doc/src/qmltypereference.qdoc +++ b/src/quick/doc/src/qmltypereference.qdoc @@ -236,11 +236,11 @@ Animation paths Models And Model Data \list -\li \l {QtQuick2::ListModel}{ListModel} - Defines a list of data -\li \l {QtQuick2::ListElement}{ListElement} - Defines a data item in a \l {QtQuick2::ListModel}{ListModel} +\li \l {QtQml2::ListModel}{ListModel} - Defines a list of data +\li \l {QtQml2::ListElement}{ListElement} - Defines a data item in a \l {QtQml2::ListModel}{ListModel} \li \l {VisualItemModel} - Contains items that already defines its own visual delegate \li \l {VisualDataModel} - Encapsulates a model and a delegate -\li \l {VisualDataGroup} -Encapsulates a filtered set of visual data items +\li \l {VisualDataGroup} - Encapsulates a filtered set of visual data items \li \l {XmlListModel} - Specifies a model using XPath expressions \li \l {XmlRole} - Specifies a role for an \l {XmlListModel} \endlist diff --git a/src/quick/doc/src/qtquick.qdoc b/src/quick/doc/src/qtquick.qdoc index 7163baa819..0a4d276cb8 100644 --- a/src/quick/doc/src/qtquick.qdoc +++ b/src/quick/doc/src/qtquick.qdoc @@ -125,7 +125,7 @@ Additional Qt Quick information: system for Qt Quick \li \l{QtQuick.Window 2}{Window} - contains types for creating top-level windows and accessing screen information - \li \l{QtQuick.Dialogs 1}{Dialogs} - contains types for creating and + \li \l{Qt Quick Dialogs}{Dialogs} - contains types for creating and interacting with system dialogs \endlist \li \l{Qt Quick Release Notes} - list of changes and additions in the Qt Quick diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 58e1612e19..110e14d266 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -1363,7 +1363,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) \brief Property used to mirror layout behavior The LayoutMirroring attached property is used to horizontally mirror \l {anchor-layout}{Item anchors}, - \l{Item Layouts}{positioner} types (such as \l Row and \l Grid) + \l{Item Positioners}{positioner} types (such as \l Row and \l Grid) and views (such as \l GridView and horizontal \l ListView). Mirroring is a visual change: left anchors become right anchors, and positioner types like \l Grid and \l Row reverse the horizontal layout of child items. @@ -1403,7 +1403,7 @@ QQuickKeysAttached *QQuickKeysAttached::qmlAttachedProperties(QObject *obj) This property holds whether the item's layout is mirrored horizontally. Setting this to true horizontally reverses \l {anchor-layout}{anchor} settings such that left anchors become right, - and right anchors become left. For \l{Item Layouts}{positioner} types + and right anchors become left. For \l{Item Positioners}{positioner} types (such as \l Row and \l Grid) and view types (such as \l {GridView}{GridView} and \l {ListView}{ListView}) this also mirrors the horizontal layout direction of the item. diff --git a/src/quick/items/qquickpositioners.cpp b/src/quick/items/qquickpositioners.cpp index 789d2e62aa..b07a38cdaf 100644 --- a/src/quick/items/qquickpositioners.cpp +++ b/src/quick/items/qquickpositioners.cpp @@ -626,7 +626,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) more information about its position within the Column. For more information on using Column and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \section1 Using Transitions @@ -644,7 +644,7 @@ void QQuickPositionerAttached::setIsLastItem(bool isLastItem) \image verticalpositioner_transition.gif - \sa Row, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Row, Grid, Flow, Positioner, ColumnLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Column::populate @@ -795,10 +795,10 @@ void QQuickColumn::reportConflictingAnchors() more information about its position within the Row. For more information on using Row and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Column, Grid, Flow, Positioner, {Qt Quick Examples - Positioners} + \sa Column, Grid, Flow, Positioner, RowLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Row::populate @@ -1028,10 +1028,10 @@ void QQuickRow::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Grid and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. - \sa Flow, Row, Column, Positioner, {Qt Quick Examples - Positioners} + \sa Flow, Row, Column, Positioner, GridLayout, {Qt Quick Examples - Positioners} */ /*! \qmlproperty Transition QtQuick2::Grid::populate @@ -1570,7 +1570,7 @@ void QQuickGrid::reportConflictingAnchors() or anchor itself with any of the \l {Item::anchors}{anchor} properties. For more information on using Flow and other related positioner-types, see - \l{Item Layouts}. + \l{Item Positioners}. \sa Column, Row, Grid, Positioner, {Qt Quick Examples - Positioners} */ diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 102066704b..f39a15070c 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -912,8 +912,8 @@ QSGNode *QQuickShaderEffect::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa { QQuickShaderEffectNode *node = static_cast<QQuickShaderEffectNode *>(oldNode); - // In the case of a bad vertex shader, don't try to create a node... - if (m_common.attributes.isEmpty()) { + // In the case of zero-size or a bad vertex shader, don't try to create a node... + if (m_common.attributes.isEmpty() || width() <= 0 || height() <= 0) { if (node) delete node; return 0; diff --git a/src/quick/items/qquickshadereffectsource.cpp b/src/quick/items/qquickshadereffectsource.cpp index bd0bb2348e..9debfe35b3 100644 --- a/src/quick/items/qquickshadereffectsource.cpp +++ b/src/quick/items/qquickshadereffectsource.cpp @@ -942,7 +942,7 @@ void QQuickShaderEffectSource::releaseResources() QSGNode *QQuickShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) { - if (!m_sourceItem || m_sourceItem->width() == 0 || m_sourceItem->height() == 0) { + if (!m_sourceItem || m_sourceItem->width() <= 0 || m_sourceItem->height() <= 0) { if (m_texture) m_texture->setItem(0); delete oldNode; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 4a34adabe8..7137bb165e 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -74,6 +74,8 @@ QT_BEGIN_NAMESPACE extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha); +bool QQuickWindowPrivate::defaultAlphaBuffer(0); + void QQuickWindowPrivate::updateFocusItemTransform() { Q_Q(QQuickWindow); @@ -2969,7 +2971,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create Setting the clear color has no effect when clearing is disabled. By default, the clear color is white. - \sa setClearBeforeRendering() + \sa setClearBeforeRendering(), setDefaultAlphaBuffer() */ void QQuickWindow::setColor(const QColor &color) @@ -2979,7 +2981,7 @@ void QQuickWindow::setColor(const QColor &color) return; if (color.alpha() != d->clearColor.alpha()) { - QSurfaceFormat fmt = format(); + QSurfaceFormat fmt = requestedFormat(); if (color.alpha() < 255) fmt.setAlphaBufferSize(8); else @@ -2997,6 +2999,31 @@ QColor QQuickWindow::color() const } /*! + \brief Returns whether to use alpha transparency on newly created windows. + + \since Qt 5.1 + \sa setDefaultAlphaBuffer() + */ +bool QQuickWindow::hasDefaultAlphaBuffer() +{ + return QQuickWindowPrivate::defaultAlphaBuffer; +} + +/*! + \brief \a useAlpha specifies whether to use alpha transparency on newly created windows. + \since Qt 5.1 + + In any application which expects to create translucent windows, it's + necessary to set this to true before creating the first QQuickWindow, + because all windows will share the same \l QOpenGLContext. The default + value is false. + */ +void QQuickWindow::setDefaultAlphaBuffer(bool useAlpha) +{ + QQuickWindowPrivate::defaultAlphaBuffer = useAlpha; +} + +/*! \qmlproperty string QtQuick.Window2::Window::title The window's title in the windowing system. diff --git a/src/quick/items/qquickwindow.h b/src/quick/items/qquickwindow.h index fc148aabe6..a0bc832334 100644 --- a/src/quick/items/qquickwindow.h +++ b/src/quick/items/qquickwindow.h @@ -115,6 +115,9 @@ public: void setColor(const QColor &color); QColor color() const; + static bool hasDefaultAlphaBuffer(); + static void setDefaultAlphaBuffer(bool useAlpha); + void setPersistentOpenGLContext(bool persistent); bool isPersistentOpenGLContext() const; diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index 9e3251b240..2465629778 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -219,6 +219,8 @@ public: mutable QQuickWindowIncubationController *incubationController; + static bool defaultAlphaBuffer; + static bool dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent *event); // data property diff --git a/src/quick/scenegraph/qsgcontext.cpp b/src/quick/scenegraph/qsgcontext.cpp index 1c7f9cd800..c47250662b 100644 --- a/src/quick/scenegraph/qsgcontext.cpp +++ b/src/quick/scenegraph/qsgcontext.cpp @@ -54,6 +54,7 @@ #include <QGuiApplication> #include <QOpenGLContext> +#include <QQuickWindow> #include <QtGui/qopenglframebufferobject.h> #include <private/qqmlglobal_p.h> @@ -396,6 +397,8 @@ QSurfaceFormat QSGContext::defaultSurfaceFormat() const QSurfaceFormat format; format.setDepthBufferSize(24); format.setStencilBufferSize(8); + if (QQuickWindow::hasDefaultAlphaBuffer()) + format.setAlphaBufferSize(8); format.setSwapBehavior(QSurfaceFormat::DoubleBuffer); return format; } |