2 Star 5 Fork 1

蔡姬 / Follower v2.0

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
toolmenu.h 1.37 KB
一键复制 编辑 原始数据 按行查看 历史
#ifndef TOOLMENU_H
#define TOOLMENU_H
#include <QDialog>
#include <QLabel>
#include <QMenu>
#include <QToolButton>
#include <functional>
namespace Ui {
class ToolMenu;
}
class ToolMenu : public QDialog
{
Q_OBJECT
public:
enum TipAlign{
UP,
DOWN,
LEFT,
RIGHT
};
public:
explicit ToolMenu(QWidget *parent = nullptr);
~ToolMenu();
QToolButton* addMenu(QMenu* menu, const QPoint& offset);
void setBtnText(QToolButton* btn, const QString& text);
QToolButton* addAction(const QString& text, const QPoint& offset, std::function<void(void)> todo);
QLabel* addLabelTip(QToolButton* target, const QString& text = "", TipAlign align = UP, int margin = 4);
void setLabelTip(QToolButton* target, QLabel* label, const QString& text, TipAlign align, int margin = 4);
void setCenter(QWidget* wgt, const QPoint& center);
private:
Ui::ToolMenu *ui;
QList<QToolButton*> btnMenuList;
QToolButton* lastHoverBtn = nullptr;
QTimer* timer = nullptr;
signals:
void closed(void);
void showed(void);
// QObject interface
public:
virtual bool eventFilter(QObject *watched, QEvent *event) override;
// QWidget interface
protected:
virtual void showEvent(QShowEvent *event) override;
// QWidget interface
protected:
virtual void closeEvent(QCloseEvent *event) override;
};
#endif // TOOLMENU_H
C++
1
https://gitee.com/caiqihang2024/follower-v2.0.git
git@gitee.com:caiqihang2024/follower-v2.0.git
caiqihang2024
follower-v2.0
Follower v2.0
master

搜索帮助