代码拉取完成,页面将自动刷新
#ifndef TITLEBAR_H
#define TITLEBAR_H
#include <QWidget>
class QLabel;
class QPushButton;
class QMenu;
class StyleButton;
class QHBoxLayout;
class TitleBar : public QWidget
{
Q_OBJECT
public:
explicit TitleBar(QWidget *parent = nullptr);
void setWindowTitle(const QString& title);
void setTitleBarIcon(const QIcon& icon);
void setMenuVisible(bool visible);
void setMinButtonVisible(bool visible);
void setMaxButtonVisible(bool visible);
void setBackgroundColor(const QColor &color);
void setMenu(QMenu* menu);
QMenu *menu() const;
void setRadius(int radius);
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
void mouseDoubleClickEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
bool eventFilter(QObject *obj, QEvent *event) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent *event) Q_DECL_OVERRIDE;
void updateMaximize();
signals:
void windowStateChange();
void minimizeButtonClicked();
void maximizeButtonClicked();
void closeButtonClicked();
private:
QLabel *m_iconLabel = Q_NULLPTR;
QLabel *m_titleLabel = Q_NULLPTR;
StyleButton *m_meunBtn = Q_NULLPTR;
StyleButton *m_minimizeButton = Q_NULLPTR;
StyleButton *m_maximizeButton = Q_NULLPTR;
StyleButton *m_closeButton = Q_NULLPTR;
QHBoxLayout *m_layout = Q_NULLPTR;
QPoint m_start;//起始点
QPoint m_end;//结束点
bool m_leftButtonPressed;//鼠标左键按下标记
QSize m_size = QSize(15, 15);
int m_radius = 15;
QColor m_color = QColor();
QMenu *m_menu = Q_NULLPTR;
};
#endif // TITLEBAR_H
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。