KDeclarative

quickviewsharedengine.h
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2015 Marco Martin <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef QUICKVIEWSHAREDENGINE_H
9 #define QUICKVIEWSHAREDENGINE_H
10 
11 #include "quickaddons_export.h"
12 
13 #include <memory>
14 #include <QQuickWindow>
15 #include <QUrl>
16 #include <QQmlError>
17 #include <QQmlComponent>
18 
19 class QQuickItem;
20 class QQmlEngine;
21 
22 namespace KQuickAddons {
23 
24 class QuickViewSharedEnginePrivate;
25 
31 class QUICKADDONS_EXPORT QuickViewSharedEngine : public QQuickWindow
32 {
33  Q_OBJECT
34 
35  Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode NOTIFY resizeModeChanged)
36  Q_PROPERTY(QQmlComponent::Status status READ status NOTIFY statusChanged)
37  Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
38 
39 public:
40  enum ResizeMode {
41  SizeViewToRootObject,
42  SizeRootObjectToView
43  };
44  Q_ENUM(ResizeMode)
45 
46  explicit QuickViewSharedEngine(QWindow *parent = nullptr);
47  ~QuickViewSharedEngine() override;
48 
65  void setTranslationDomain(const QString &translationDomain);
66 
71  QString translationDomain() const;
72 
73  QQmlEngine *engine() const;
74  QList<QQmlError> errors() const;
75  QSize sizeHint() const;
76  QSize initialSize() const;
77  QQmlContext *rootContext() const;
78  QQuickItem *rootObject() const;
79  QUrl source() const;
80  QQmlComponent::Status status() const;
81  ResizeMode resizeMode() const;
82  void setResizeMode(ResizeMode);
83 
84 protected:
85  void resizeEvent(QResizeEvent *e) override;
86 
87 public Q_SLOTS:
88  void setSource(const QUrl &url);
89 
90 Q_SIGNALS:
91  void statusChanged(QQmlComponent::Status status);
92  void resizeModeChanged(QuickViewSharedEngine::ResizeMode resizeMode);
93  void sourceChanged(const QUrl &source);
94 
95 
96 private:
97  const std::unique_ptr<QuickViewSharedEnginePrivate> d;
98 
99  Q_PRIVATE_SLOT(d, void executionFinished())
100  Q_PRIVATE_SLOT(d, void syncWidth())
101  Q_PRIVATE_SLOT(d, void syncHeight())
102 };
103 
104 }
105 
106 
107 #endif //QuickViewSharedEngine_H
108 
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:39:19 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.