** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/
**
-** This file is part of the QtDeclarative module of the Qt Toolkit.
+** This file is part of the QtQml module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
/*!
\qmlclass Screen QQuickScreenAttached
\inqmlmodule QtQuick.Window 2
+ \ingroup qtquick-visual-utility
\brief The Screen attached object provides information about the Screen an Item is displayed on.
- The Screen attached object is only valid inside Item or Item derived elements. Inside these elements
- it refers to the screen that the element is currently being displayed on.
+ The Screen attached object is only valid inside Item or Item derived elements, after component completion.
+ Inside these elements it refers to the screen that the element is currently being displayed on.
+
+ To use this element, you will need to import the module with the following line:
+ \code
+ import QtQuick.Window 2.0
+ \endcode
+
+ Note that the Screen element is not valid at Component.onCompleted, because the Item has not been displayed on
+ a screen by this time.
+
+ Restricting this import will allow you to have a QML environment without access to window system features.
*/
/*!
- \qmlattachedproperty int QtQuickWindow2::Screen::width
+ \qmlattachedproperty int QtQuick.Window2::Screen::width
\readonly
This contains the width of the screen in pixels.
*/
/*!
- \qmlattachedproperty int QtQuickWindow2::Screen::height
+ \qmlattachedproperty int QtQuick.Window2::Screen::height
\readonly
This contains the height of the screen in pixels.
*/
/*!
- \qmlattachedproperty Qt::ScreenOrientation QtQuickWindow2::Screen::primaryOrientation
+ \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window2::Screen::primaryOrientation
\readonly
This contains the primary orientation of the screen.
*/
/*!
- \qmlattachedproperty Qt::ScreenOrientation QtQuickWindow2::Screen::orientation
+ \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window2::Screen::orientation
\readonly
This contains the current orientation of the screen.
*/
/*!
- \qmlattachedmethod int QtQuickWindow2::Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
+ \qmlattachedmethod int QtQuick.Window2::Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
Returns the rotation angle, in degrees, between the two specified angles.
*/
m_attachee = qobject_cast<QQuickItem*>(attachee);
if (m_attachee) {
- QQuickItemPrivate::get(m_attachee)->screenAttached = this;
+ QQuickItemPrivate::get(m_attachee)->extra.value().screenAttached = this;
if (m_attachee->canvas()) //It might not be assigned to a canvas yet
canvasChanged(m_attachee->canvas());