Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickview.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QQUICKVIEW_H
6#define QQUICKVIEW_H
7
8#include <QtQuick/qquickwindow.h>
9#include <QtCore/qurl.h>
10
12
13class QQmlEngine;
14class QQmlContext;
15class QQmlError;
16class QQuickItem;
17class QQmlComponent;
18
19class QQuickViewPrivate;
20class Q_QUICK_EXPORT QQuickView : public QQuickWindow
21{
22 Q_OBJECT
23 Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode)
24 Q_PROPERTY(Status status READ status NOTIFY statusChanged)
25 Q_PROPERTY(QUrl source READ source WRITE setSource DESIGNABLE true)
26public:
27 explicit QQuickView(QWindow *parent = nullptr);
28 QQuickView(QQmlEngine* engine, QWindow *parent);
29 explicit QQuickView(const QUrl &source, QWindow *parent = nullptr);
30 explicit QQuickView(QAnyStringView uri, QAnyStringView typeName, QWindow *parent = nullptr);
31 QQuickView(const QUrl &source, QQuickRenderControl *renderControl);
32 ~QQuickView() override;
33
34 QUrl source() const;
35
36 QQmlEngine* engine() const;
37 QQmlContext* rootContext() const;
38
39 QQuickItem *rootObject() const;
40
41 enum ResizeMode { SizeViewToRootObject, SizeRootObjectToView };
42 Q_ENUM(ResizeMode)
43 ResizeMode resizeMode() const;
44 void setResizeMode(ResizeMode);
45
46 enum Status { Null, Ready, Loading, Error };
47 Q_ENUM(Status)
48 Status status() const;
49
50 QList<QQmlError> errors() const;
51
52 QSize sizeHint() const;
53 QSize initialSize() const;
54
55public Q_SLOTS:
56 void setSource(const QUrl&);
57 void loadFromModule(QAnyStringView uri, QAnyStringView typeName);
58 void setInitialProperties(const QVariantMap &initialProperties);
59 void setContent(const QUrl& url, QQmlComponent *component, QObject *item);
60
61Q_SIGNALS:
62 void statusChanged(QQuickView::Status);
63
64private Q_SLOTS:
65 void continueExecute();
66
67protected:
68 void resizeEvent(QResizeEvent *) override;
69 void timerEvent(QTimerEvent*) override;
70
71 void keyPressEvent(QKeyEvent *) override;
72 void keyReleaseEvent(QKeyEvent *) override;
73 void mousePressEvent(QMouseEvent *) override;
74 void mouseReleaseEvent(QMouseEvent *) override;
75 void mouseMoveEvent(QMouseEvent *) override;
76private:
77 Q_DISABLE_COPY(QQuickView)
78 Q_DECLARE_PRIVATE(QQuickView)
79};
80
81QT_END_NAMESPACE
82
83#endif // QQUICKVIEW_H
void messageReceived(const QByteArray &message) override
void foundTranslationBinding(const TranslationBindingInformation &translationBindingInformation) override
void engineAboutToBeAdded(QJSEngine *engine) override
void state(const QString &stateName)
void engineAboutToBeRemoved(QJSEngine *engine) override
QMultiMap< QObject *, TranslationBindingInformation > objectTranslationBindingMultiMap
QList< QPointer< QQuickItem > > translatableTextOccurrences
std::unique_ptr< QAbstractFileEngine > create(const QString &fileName) const override
If this file handler can handle fileName, this method creates a file engine and returns it wrapped in...
QQmlPreviewFileLoader(QQmlPreviewServiceImpl *service)
Result load(const QString &file)
bool isBlacklisted(const QString &file)
void whitelist(const QUrl &url)
void dropCU(const QUrl &url)
void zoom(qreal newFactor)
QQuickItem * currentRootItem()
bool eventFilter(QObject *obj, QEvent *event) override
Filters events if this object has been installed as an event filter for the watched object.
void fps(const FpsInfo &info)
void removeEngine(QQmlEngine *engine)
void addEngine(QQmlEngine *engine)
void loadUrl(const QUrl &url)
bool operator==(const QQmlPreviewPosition::ScreenData &other) const
void loadWindowPositionSettings(const QUrl &url)
void takePosition(QWindow *window, InitializeState state=PositionInitialized)
void initLastSavedWindowPosition(QWindow *window)
void forwardRequest(const QString &file)
void drop(const QUrl &url)
void engineAboutToBeRemoved(QJSEngine *engine) override
QQmlPreviewServiceImpl(QObject *parent=nullptr)
void file(const QString &file, const QByteArray &contents)
void directory(const QString &file, const QStringList &entries)
void engineAboutToBeAdded(QJSEngine *engine) override
void forwardFps(const QQmlPreviewHandler::FpsInfo &frames)
void zoom(qreal factor)
static const QString s_key
void load(const QUrl &url)
void stateChanged(State state) override
void forwardError(const QString &error)
void messageReceived(const QByteArray &message) override
The QQuickView class provides a window for displaying a Qt Quick user interface.
Definition qquickview.h:21
QDebug operator<<(QDebug dbg, const QFileInfo &fi)
static QString translationIdString(const QQmlTranslation::QsTrData &data)