QtCanpool 3.3.0
载入中...
搜索中...
未找到
qxplugincontext.h
浏览该文件的文档.
1
5#ifndef QXPLUGINCONTEXT_H
6#define QXPLUGINCONTEXT_H
7
8#include "qxplugin_global.h"
9
10#include "qxcore/qxsettings.h"
11
12#include <QtCore/QString>
13#include <QtCore/QStringList>
14#include <QtGui/QIcon>
15#include <QtWidgets/QWidget>
16
18
34{
35public:
37
39 enum DockArea {
40 LeftDock = 0x1,
41 RightDock = 0x2,
42 TopDock = 0x4,
43 BottomDock = 0x8
44 };
45
47 enum class ToastLevel {
48 Information,
49 Success,
50 Warning,
51 Error
52 };
53
54 // Pages -----------------------------------------------------------------
62 virtual void addPage(const QString &id, const QIcon &icon, const QString &title, QWidget *page) = 0;
64 virtual void setCurrentPage(const QString &id) = 0;
66 virtual QString currentPageId() const = 0;
67
68 // Docks -----------------------------------------------------------------
74 virtual QWidget *addDock(DockArea area, const QString &id, const QString &title, QWidget *widget) = 0;
75
76 // Status bar ------------------------------------------------------------
78 virtual void setStatusMessage(const QString &message) = 0;
80 virtual void setBusy(bool busy) = 0;
82 virtual void setProgressRange(int minimum, int maximum) = 0;
84 virtual void setProgress(int value) = 0;
86 virtual void clearProgress() = 0;
87
88 // Notifications ---------------------------------------------------------
90 virtual void showToast(const QString &text, ToastLevel level = ToastLevel::Information, int timeoutMs = -1) = 0;
91
92 // Config ----------------------------------------------------------------
94 virtual QX_CORE_PREPEND_NAMESPACE(QxSettings) * settings() const = 0;
95};
96
98
99#endif // QXPLUGINCONTEXT_H
The thin surface a plugin programs against.
virtual void setStatusMessage(const QString &message)=0
Replaces the host's persistent status-line message.
ToastLevel
Toast severity understood by every host.
virtual QString currentPageId() const =0
Id of the page currently on screen, or an empty string when there is none.
DockArea
Where a newly added dock lands.
virtual void setProgress(int value)=0
Shows how far the work has got, clamped to the range set by setProgressRange().
virtual void setBusy(bool busy)=0
Shows or hides the host's indeterminate "working" indicator.
virtual void showToast(const QString &text, ToastLevel level=ToastLevel::Information, int timeoutMs=-1)=0
Shows a toast over the host; timeoutMs < 0 means the host's default.
virtual QxCore::QxSettings * settings() const =0
The settings object backing persistence; never null.
virtual void addPage(const QString &id, const QIcon &icon, const QString &title, QWidget *page)=0
Adds a page to the host's central workspace and registers it under id, which must be stable and uniqu...
virtual void setProgressRange(int minimum, int maximum)=0
Sets the range the progress runs in; maximum must be above minimum.
virtual QWidget * addDock(DockArea area, const QString &id, const QString &title, QWidget *widget)=0
Creates a dock widget named id, titled title, filled with widget and dropped in area.
virtual void clearProgress()=0
Hides the progress or busy indicator and resets it to the minimum.
virtual void setCurrentPage(const QString &id)=0
Brings the page registered under id to the front.
#define QX_CORE_PREPEND_NAMESPACE(name)
#define QX_PLUGIN_BEGIN_NAMESPACE
#define QX_PLUGIN_END_NAMESPACE
#define QX_PLUGIN_EXPORT
QColor text