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
qtresourcemodel_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header
11// file may change from version to version without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef QTRESOURCEMODEL_H
17#define QTRESOURCEMODEL_H
18
20#include <QtCore/qmap.h>
21#include <QtCore/qobject.h>
22
23#include <memory>
24
25QT_BEGIN_NAMESPACE
26
27class QtResourceModel;
28
29class QDESIGNER_SHARED_EXPORT QtResourceSet // one instance per one form
30{
31public:
32 QStringList activeResourceFilePaths() const;
33
34 // activateQrcPaths(): if this QtResourceSet is active it emits resourceSetActivated();
35 // otherwise only in case if active QtResource set contains one of
36 // paths which was marked as modified by this resource set, the signal
37 // is emitted (with reload = true);
38 // If new path appears on the list it is automatically added to
39 // loaded list of QtResourceModel. In addition it is marked as modified in case
40 // QtResourceModel didn't contain the path.
41 // If some path is removed from that list (and is not used in any other
42 // resource set) it is automatically unloaded. The removed file can also be
43 // marked as modified (later when another resource set which contains
44 // removed path is activated will be reloaded)
45 void activateResourceFilePaths(const QStringList &paths, int *errorCount = nullptr, QString *errorMessages = nullptr);
46
47 bool isModified(const QString &path) const; // for all paths in resource model (redundant here, maybe it should be removed from here)
48 void setModified(const QString &path); // for all paths in resource model (redundant here, maybe it should be removed from here)
49private:
50 QtResourceSet();
51 QtResourceSet(QtResourceModel *model);
52 ~QtResourceSet();
53 friend class QtResourceModel;
54
55 std::unique_ptr<class QtResourceSetPrivate> d_ptr;
56 Q_DECLARE_PRIVATE(QtResourceSet)
57 Q_DISABLE_COPY_MOVE(QtResourceSet)
58};
59
60class QDESIGNER_SHARED_EXPORT QtResourceModel : public QObject // one instance per whole designer
61{
62 Q_OBJECT
63public:
64 QtResourceModel(QObject *parent = nullptr);
65 ~QtResourceModel() override;
66
67 QStringList loadedQrcFiles() const;
68 bool isModified(const QString &path) const; // only for paths which are on loadedQrcFiles() list
69 void setModified(const QString &path); // only for paths which are on loadedQrcPaths() list
70
71 QList<QtResourceSet *> resourceSets() const;
72
73 QtResourceSet *currentResourceSet() const;
74 void setCurrentResourceSet(QtResourceSet *resourceSet, int *errorCount = nullptr, QString *errorMessages = nullptr);
75
76 QtResourceSet *addResourceSet(const QStringList &paths);
77 void removeResourceSet(QtResourceSet *resourceSet);
78
79 void reload(const QString &path, int *errorCount = nullptr, QString *errorMessages = nullptr);
80 void reload(int *errorCount = nullptr, QString *errorMessages = nullptr);
81
82 // Contents of the current resource set (content file to qrc path)
83 QMap<QString, QString> contents() const;
84 // Find the qrc file belonging to the contained file (from current resource set)
85 QString qrcPath(const QString &file) const;
86
87 void setWatcherEnabled(bool enable);
88 bool isWatcherEnabled() const;
89
90 void setWatcherEnabled(const QString &path, bool enable);
91 bool isWatcherEnabled(const QString &path);
92
93signals:
94 void resourceSetActivated(QtResourceSet *resourceSet, bool resourceSetChanged); // resourceSetChanged since last time it was activated!
95 void qrcFileModifiedExternally(const QString &path);
96
97private:
98 friend class QtResourceSet;
99
100 std::unique_ptr<class QtResourceModelPrivate> d_ptr;
101 Q_DECLARE_PRIVATE(QtResourceModel)
102 Q_DISABLE_COPY_MOVE(QtResourceModel)
103};
104
105QT_END_NAMESPACE
106
107#endif
virtual bool dynamicPropertiesAllowed() const =0
virtual bool isDynamicProperty(int index) const =0
virtual int addDynamicProperty(const QString &propertyName, const QVariant &value)=0
virtual bool canAddDynamicProperty(const QString &propertyName) const =0
virtual bool removeDynamicProperty(int index)=0
virtual ~QDesignerDynamicPropertySheetExtension()=default
QDesignerPropertySheetFactory(QExtensionManager *parent=nullptr)
static void registerExtension(QExtensionManager *mgr)
friend class QWidget
Definition qpainter.h:432
FormEditorOptionsPage(QDesignerFormEditorInterface *core)
QWidget * createPage(QWidget *parent) override
FormEditor(const QStringList &pluginPaths, QObject *parent=nullptr)
void setProperty(int index, const QVariant &value) override
void setChanged(int index, bool changed) override
QVariant property(int index) const override
QString propertyGroup(int index) const override
bool isVisible(int index) const override
void setProperty(int index, const QVariant &value) override
void setProperty(int index, const QVariant &value) override
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
void addWidget(QWidget *widget) override
static void positionNewMdiChild(const QWidget *area, QWidget *mdiChild)
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
void setProperty(int index, const QVariant &value) override
static bool checkProperty(const QString &propertyName)
QVariant property(int index) const override
void addWidget(QWidget *widget) override
QWidget * widget(int index) const override
void insertWidget(int index, QWidget *widget) override
bool isVisible(int index) const override
void setProperty(int index, const QVariant &value) override
QWidget * createPage(QWidget *parent) override
static QString chooseTemplatePath(QDesignerFormEditorInterface *core, QWidget *parent)
#define QT_FORMEDITOR_EXPORT
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
QDesignerPropertySheetFactory< QWizardPage, QWizardPagePropertySheet > QWizardPagePropertySheetFactory
#define QDESIGNER_SHARED_EXPORT