QQuickView ClassThe QQuickView class provides a window for displaying a Qt Quick user interface. More... #include <QQuickView> Inherits: QQuickCanvas. This class was introduced in QtQuick 2.0. Public Types
Properties
Public Functions
Public Slots
Signals
Protected Functions
Reimplemented Protected Functions
Additional Inherited Members
Detailed DescriptionThe QQuickView class provides a window for displaying a Qt Quick user interface. This is a convenience subclass of QQuickCanvas which will automatically load and display a QML scene when given the URL of the main source file. Alternatively, you can instantiate your own objects using QQmlComponent and place them in a manually setup QQuickCanvas. Typical usage: QQuickView *view = new QQuickView; view->setSource(QUrl::fromLocalFile("myqmlfile.qml")); view->show(); To receive errors related to loading and executing QML with QQuickView, you can connect to the statusChanged() signal and monitor for QQuickView::Error. The errors are available via QQuickView::errors(). See also Using QML Bindings in C++ Applications. Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QQuickView::SizeViewToRootObject | 0 | The view resizes with the root item in the QML. |
QQuickView::SizeRootObjectToView | 1 | The view will automatically resize the root item to the size of the view. |
Specifies the loading status of the QQuickView.
Constant | Value | Description |
---|---|---|
QQuickView::Null | 0 | This QQuickView has no source set. |
QQuickView::Ready | 1 | This QQuickView has loaded and created the QML component. |
QQuickView::Loading | 2 | This QQuickView is loading network data. |
QQuickView::Error | 3 | One or more errors has occurred. Call errors() to retrieve a list of errors. |
This property holds whether the view should resize the canvas contents.
If this property is set to SizeViewToRootObject (the default), the view resizes with the root item in the QML.
If this property is set to SizeRootObjectToView, the view will automatically resize the root item.
Regardless of this property, the sizeHint of the view is the initial size of the root item. Note though that since QML may load dynamically, that size may change.
Access functions:
ResizeMode | resizeMode() const |
void | setResizeMode(ResizeMode) |
This property holds the URL of the source of the QML component.
Changing this property causes the QML component to be reloaded.
Ensure that the URL provided is full and correct, in particular, use QUrl::fromLocalFile() when loading a file from the local filesystem.
Access functions:
QUrl | source() const |
void | setSource(const QUrl & url) |
The component's current status.
Access functions:
Status | status() const |
Notifier signal:
void | statusChanged(QQuickView::Status status) |
Constructs a QQuickView with the given parent and window flags f. The default value of parent is 0, default window flags f is Qt::Window.
See also Qt::WindowFlags.
Constructs a QQuickView with the given QML engine, parent and a window flags f. The default value of parent is 0, default window flags f is Qt::Window.
Note: In this case, the QQuickView does not own the given engine object; it is the caller's responsibility to destroy the engine. If the engine is deleted before the view status() will return QQuickView::Error.
See also Status, status(), errors(), and Qt::WindowFlags.
Returns a pointer to the QQmlEngine used for instantiating QML Components.
Return the list of errors that occurred during the last compile or create operation. When the status is not Error, an empty list is returned.
Returns the initial size of the root object
Reimplemented from QWindow::keyPressEvent().
Reimplemented from QWindow::keyReleaseEvent().
Reimplemented from QWindow::mouseMoveEvent().
Reimplemented from QWindow::mousePressEvent().
Reimplemented from QWindow::mouseReleaseEvent().
This function returns the root of the context hierarchy. Each QML component is instantiated in a QQmlContext. QQmlContext's are essential for passing data to QML components. In QML, contexts are arranged hierarchically and this hierarchy is managed by the QQmlEngine.
Returns the view's root item.