You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AppFlow/GUIWidget/MainMenuBase.h

94 lines
2.5 KiB
C

/**
* @file MainMenuBase.h
* @brief ribbon
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-06-11
*/
#ifndef __MAINMENUBASE_H__
#define __MAINMENUBASE_H__
#include <QIcon>
#include <QList>
#include <QMenu>
#include "GUIWidgetAPI.h"
namespace GUI
{
class GUIWIDGETAPI MenuActionItem {
public:
MenuActionItem();
MenuActionItem(QString title, QString action, QIcon icon, bool checkable = false, QString checkGroup = "");
MenuActionItem(QString title, QString action, bool checkable = false, QString checkGroup = "");
MenuActionItem(QString title, QString action, QList<MenuActionItem*> childs);
~MenuActionItem() = default;
bool getSeparator() const;
bool getCheckable() const;
QString getCheckGroup() const;
QString getTitle() const;
QIcon getIcon() const;
QString getOperAction() const;
QList<MenuActionItem*> getChilds() const;
QKeySequence getKey() const;
private:
bool m_Separator{ false };
bool m_Checkable{ false };
QString m_CheckGroup{};
QString m_Title{};
QIcon m_Icon{};
QString m_OperAction{};
QList<MenuActionItem*> m_Childs{};
QKeySequence m_Key{};
};
class MainWindow;
/**
* @brief
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-06-11
*/
class GUIWIDGETAPI MainMenuBase : public QObject
{
public:
/**
* @brief
* @param mainWindow
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-06-11
*/
MainMenuBase(MainWindow* mainWindow);
/**
* @brief
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-06-11
*/
virtual ~MainMenuBase() = default;
/**
* @brief
* @param title
* @param actions actions
* @param parent
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-06-11
*/
virtual void addMenu(QString title, QList<MenuActionItem*> actions, QMenu* parent = nullptr);
/**
* @brief
* @param title
* @param actions actions
* @param style
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-06-11
*/
virtual void addToolMenu(QString title, QList<MenuActionItem*> actions, Qt::ToolButtonStyle style = Qt::ToolButtonStyle::ToolButtonIconOnly);
protected:
/**
* @brief
* @author YanZhiHui (chanyuantiandao@126.com)
* @date 2024-06-11
*/
MainWindow* m_MainWindow{};
};
}
#endif // !__MAINMENUBASE_H__