add StateIcon
This commit is contained in:
90
libs/widgets/plugin/stateiconplugin.h
Normal file
90
libs/widgets/plugin/stateiconplugin.h
Normal file
@@ -0,0 +1,90 @@
|
||||
#ifndef stateiconplugin_H
|
||||
#define stateiconplugin_H
|
||||
|
||||
#include <QObject>
|
||||
#if QT_VERSION >= 0x050000
|
||||
# include <QtUiPlugin/QDesignerCustomWidgetInterface>
|
||||
#else
|
||||
# include <QDesignerCustomWidgetInterface>
|
||||
#endif
|
||||
#include "stateicon.h"
|
||||
|
||||
#include <QDesignerPropertyEditorInterface>
|
||||
#include <QDesignerTaskMenuExtension>
|
||||
#include <QDialog>
|
||||
#include <QExtensionFactory>
|
||||
#include <QTreeWidget>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class StateIconMenuExtension;
|
||||
}
|
||||
|
||||
class StateIconMenuExtension
|
||||
: public QDialog
|
||||
, public QDesignerTaskMenuExtension {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerTaskMenuExtension)
|
||||
|
||||
public:
|
||||
StateIconMenuExtension(StateIcon * widget, QObject * parent);
|
||||
~StateIconMenuExtension();
|
||||
|
||||
QAction * preferredEditAction() const override;
|
||||
QList<QAction *> taskActions() const override;
|
||||
|
||||
public slots:
|
||||
void accept() override;
|
||||
|
||||
private slots:
|
||||
void on_tree_itemClicked(QTreeWidgetItem * item, int column);
|
||||
void on_tree_itemDoubleClicked(QTreeWidgetItem * item, int column);
|
||||
void on_buttonAdd_clicked();
|
||||
void on_buttonDel_clicked();
|
||||
void action_default_triggered();
|
||||
|
||||
private:
|
||||
Ui::StateIconMenuExtension * ui;
|
||||
StateIcon * widget;
|
||||
QAction * action_default;
|
||||
QIcon icon_command;
|
||||
};
|
||||
|
||||
|
||||
class StateIconTaskMenuFactory: public QExtensionFactory {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StateIconTaskMenuFactory(QExtensionManager * parent = 0): QExtensionFactory(parent) { ; }
|
||||
|
||||
protected:
|
||||
QObject * createExtension(QObject * object, const QString & iid, QObject * parent) const;
|
||||
};
|
||||
|
||||
|
||||
class StateIconPlugin
|
||||
: public QObject
|
||||
, public QDesignerCustomWidgetInterface {
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface)
|
||||
|
||||
public:
|
||||
StateIconPlugin(QObject * parent = 0);
|
||||
|
||||
bool isContainer() const;
|
||||
bool isInitialized() const;
|
||||
QIcon icon() const;
|
||||
QString domXml() const;
|
||||
QString group() const;
|
||||
QString includeFile() const;
|
||||
QString name() const;
|
||||
QString toolTip() const;
|
||||
QString whatsThis() const;
|
||||
QWidget * createWidget(QWidget * parent);
|
||||
void initialize(QDesignerFormEditorInterface * core);
|
||||
|
||||
private:
|
||||
bool m_initialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user