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#include <QtCore/qscopedpointer.h>
22
24
25class QtResourceModel;
26
27class QDESIGNER_SHARED_EXPORT QtResourceSet // one instance per one form
28{
29public:
30 QStringList activeResourceFilePaths() const;
31
32 // activateQrcPaths(): if this QtResourceSet is active it emits resourceSetActivated();
33 // otherwise only in case if active QtResource set contains one of
34 // paths which was marked as modified by this resource set, the signal
35 // is emitted (with reload = true);
36 // If new path appears on the list it is automatically added to
37 // loaded list of QtResourceModel. In addition it is marked as modified in case
38 // QtResourceModel didn't contain the path.
39 // If some path is removed from that list (and is not used in any other
40 // resource set) it is automatically unloaded. The removed file can also be
41 // marked as modified (later when another resource set which contains
42 // removed path is activated will be reloaded)
43 void activateResourceFilePaths(const QStringList &paths, int *errorCount = nullptr, QString *errorMessages = nullptr);
44
45 bool isModified(const QString &path) const; // for all paths in resource model (redundant here, maybe it should be removed from here)
46 void setModified(const QString &path); // for all paths in resource model (redundant here, maybe it should be removed from here)
47private:
48 QtResourceSet();
49 QtResourceSet(QtResourceModel *model);
50 ~QtResourceSet();
51 friend class QtResourceModel;
52
53 QScopedPointer<class QtResourceSetPrivate> d_ptr;
54 Q_DECLARE_PRIVATE(QtResourceSet)
55 Q_DISABLE_COPY_MOVE(QtResourceSet)
56};
57
58class QDESIGNER_SHARED_EXPORT QtResourceModel : public QObject // one instance per whole designer
59{
60 Q_OBJECT
61public:
62 QtResourceModel(QObject *parent = nullptr);
63 ~QtResourceModel();
64
65 QStringList loadedQrcFiles() const;
66 bool isModified(const QString &path) const; // only for paths which are on loadedQrcFiles() list
67 void setModified(const QString &path); // only for paths which are on loadedQrcPaths() list
68
69 QList<QtResourceSet *> resourceSets() const;
70
71 QtResourceSet *currentResourceSet() const;
72 void setCurrentResourceSet(QtResourceSet *resourceSet, int *errorCount = nullptr, QString *errorMessages = nullptr);
73
74 QtResourceSet *addResourceSet(const QStringList &paths);
75 void removeResourceSet(QtResourceSet *resourceSet);
76
77 void reload(const QString &path, int *errorCount = nullptr, QString *errorMessages = nullptr);
78 void reload(int *errorCount = nullptr, QString *errorMessages = nullptr);
79
80 // Contents of the current resource set (content file to qrc path)
81 QMap<QString, QString> contents() const;
82 // Find the qrc file belonging to the contained file (from current resource set)
83 QString qrcPath(const QString &file) const;
84
85 void setWatcherEnabled(bool enable);
86 bool isWatcherEnabled() const;
87
88 void setWatcherEnabled(const QString &path, bool enable);
89 bool isWatcherEnabled(const QString &path);
90
91signals:
92 void resourceSetActivated(QtResourceSet *resourceSet, bool resourceSetChanged); // resourceSetChanged since last time it was activated!
93 void qrcFileModifiedExternally(const QString &path);
94
95private:
96 friend class QtResourceSet;
97
98 QScopedPointer<class QtResourceModelPrivate> d_ptr;
99 Q_DECLARE_PRIVATE(QtResourceModel)
100 Q_DISABLE_COPY_MOVE(QtResourceModel)
101};
102
103QT_END_NAMESPACE
104
105#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:421
FormEditorOptionsPage(QDesignerFormEditorInterface *core)
QWidget * createPage(QWidget *parent) override
FormEditor(const QStringList &pluginPaths, QObject *parent=nullptr)
void setProperty(int index, const QVariant &value) override
static void markChangedStretchProperties(QDesignerFormEditorInterface *core, QLayout *lt, const DomLayout *domLayout)
static void stretchAttributesToDom(QDesignerFormEditorInterface *core, QLayout *lt, DomLayout *domLayout)
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.
#define QDESIGNER_SHARED_EXPORT