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
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists for the convenience
9// of Qt Designer. This header
10// file may change from version to version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef QTRESOURCEMODEL_H
16#define QTRESOURCEMODEL_H
17
19#include <QtCore/qmap.h>
20#include <QtCore/qobject.h>
21
22#include <memory>
23
24QT_BEGIN_NAMESPACE
25
26class QtResourceModel;
27
28class QDESIGNER_SHARED_EXPORT QtResourceSet // one instance per one form
29{
30public:
31 QStringList activeResourceFilePaths() const;
32
33 // activateQrcPaths(): if this QtResourceSet is active it emits resourceSetActivated();
34 // otherwise only in case if active QtResource set contains one of
35 // paths which was marked as modified by this resource set, the signal
36 // is emitted (with reload = true);
37 // If new path appears on the list it is automatically added to
38 // loaded list of QtResourceModel. In addition it is marked as modified in case
39 // QtResourceModel didn't contain the path.
40 // If some path is removed from that list (and is not used in any other
41 // resource set) it is automatically unloaded. The removed file can also be
42 // marked as modified (later when another resource set which contains
43 // removed path is activated will be reloaded)
44 void activateResourceFilePaths(const QStringList &paths, int *errorCount = nullptr, QString *errorMessages = nullptr);
45
46 bool isModified(const QString &path) const; // for all paths in resource model (redundant here, maybe it should be removed from here)
47 void setModified(const QString &path); // for all paths in resource model (redundant here, maybe it should be removed from here)
48private:
49 QtResourceSet();
50 QtResourceSet(QtResourceModel *model);
51 ~QtResourceSet();
52 friend class QtResourceModel;
53
54 std::unique_ptr<class QtResourceSetPrivate> d_ptr;
55 Q_DECLARE_PRIVATE(QtResourceSet)
56 Q_DISABLE_COPY_MOVE(QtResourceSet)
57};
58
59class QDESIGNER_SHARED_EXPORT QtResourceModel : public QObject // one instance per whole designer
60{
61 Q_OBJECT
62public:
63 QtResourceModel(QObject *parent = nullptr);
64 ~QtResourceModel() override;
65
66 QStringList loadedQrcFiles() const;
67 bool isModified(const QString &path) const; // only for paths which are on loadedQrcFiles() list
68 void setModified(const QString &path); // only for paths which are on loadedQrcPaths() list
69
70 QList<QtResourceSet *> resourceSets() const;
71
72 QtResourceSet *currentResourceSet() const;
73 void setCurrentResourceSet(QtResourceSet *resourceSet, int *errorCount = nullptr, QString *errorMessages = nullptr);
74
75 QtResourceSet *addResourceSet(const QStringList &paths);
76 void removeResourceSet(QtResourceSet *resourceSet);
77
78 void reload(const QString &path, int *errorCount = nullptr, QString *errorMessages = nullptr);
79 void reload(int *errorCount = nullptr, QString *errorMessages = nullptr);
80
81 // Contents of the current resource set (content file to qrc path)
82 QMap<QString, QString> contents() const;
83 // Find the qrc file belonging to the contained file (from current resource set)
84 QString qrcPath(const QString &file) const;
85
86 void setWatcherEnabled(bool enable);
87 bool isWatcherEnabled() const;
88
89 void setWatcherEnabled(const QString &path, bool enable);
90 bool isWatcherEnabled(const QString &path);
91
92signals:
93 void resourceSetActivated(QtResourceSet *resourceSet, bool resourceSetChanged); // resourceSetChanged since last time it was activated!
94 void qrcFileModifiedExternally(const QString &path);
95
96private:
97 friend class QtResourceSet;
98
99 std::unique_ptr<class QtResourceModelPrivate> d_ptr;
100 Q_DECLARE_PRIVATE(QtResourceModel)
101 Q_DISABLE_COPY_MOVE(QtResourceModel)
102};
103
104QT_END_NAMESPACE
105
106#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:431
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