2022-09-29 20:28:54 +08:00
|
|
|
#ifndef TITLEBAR_H
|
|
|
|
#define TITLEBAR_H
|
|
|
|
|
|
|
|
#define KYLIN_USER_GUIDE_PATH "/"
|
|
|
|
#define KYLIN_USER_GUIDE_SERVICE "com.kylinUserGuide.hotel"
|
|
|
|
#define KYLIN_USER_GUIDE_INTERFACE "com.guide.hotel"
|
|
|
|
|
|
|
|
#include <QWidget>
|
|
|
|
#include <QToolButton>
|
|
|
|
#include <QPushButton>
|
|
|
|
#include <QMenu>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QList>
|
|
|
|
#include <QAction>
|
|
|
|
#include <QPalette>
|
|
|
|
#include <unistd.h>
|
2022-10-12 17:36:52 +08:00
|
|
|
#include "publicattributes.hpp"
|
2022-09-29 20:28:54 +08:00
|
|
|
|
|
|
|
class Titlebar : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
Titlebar(QWidget *parent = nullptr);
|
|
|
|
~Titlebar();
|
2022-11-22 09:38:14 +08:00
|
|
|
void changeMode(PublicAttributes::Model model);
|
2022-11-02 11:14:51 +08:00
|
|
|
void setMaxBtnMode(bool isMax);
|
2022-09-29 20:28:54 +08:00
|
|
|
void initHelp(); // 设置帮助Action
|
2022-10-12 17:36:52 +08:00
|
|
|
void setTheme(PublicAttributes::Theme theme);
|
2022-09-29 20:28:54 +08:00
|
|
|
void setBackground(bool isDefault = true);
|
2022-12-14 11:00:59 +08:00
|
|
|
void changeFontSize(double fontSize);
|
2022-09-29 20:28:54 +08:00
|
|
|
|
2022-10-18 16:29:21 +08:00
|
|
|
protected:
|
|
|
|
void mouseDoubleClickEvent(QMouseEvent *event);
|
|
|
|
|
2022-09-29 20:28:54 +08:00
|
|
|
Q_SIGNALS:
|
|
|
|
void sigAboutWinShow();
|
|
|
|
public Q_SLOTS:
|
|
|
|
void onClicked(void);
|
|
|
|
void triggerMenu(QAction *);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void initUI();
|
|
|
|
void connectInit(void); // 绑定槽函数
|
|
|
|
void initMenu(void); // 设置菜单
|
|
|
|
void initAbout(); // 设置关于Action
|
|
|
|
|
|
|
|
private:
|
|
|
|
QPushButton *m_titleIcon = nullptr;
|
|
|
|
QLabel *m_titleNameLab = nullptr;
|
2022-10-12 17:36:52 +08:00
|
|
|
QToolButton *m_menuBtn = nullptr; // 菜单按钮
|
|
|
|
QMenu *m_menu = nullptr; // 菜单
|
|
|
|
QList<QAction *> m_actions; // action组
|
|
|
|
QPushButton *m_minBtn = nullptr; // 最小化按钮
|
|
|
|
QPushButton *m_maxBtn; // 最大化按钮
|
|
|
|
QPushButton *m_closeBtn = nullptr; // 关闭按钮
|
|
|
|
PublicAttributes::Theme m_theme = PublicAttributes::Theme::Light; // 主题
|
|
|
|
bool m_isDefault = true;
|
2022-12-28 10:42:53 +08:00
|
|
|
bool m_isMaximize = false;
|
2022-09-29 20:28:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TITLEBAR_H
|