Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
TitleBarButton.h
Go to the documentation of this file.
1#pragma once
2#include <QPainter>
3#include <QResizeEvent>
4#include <QWidget>
5#include <misc/global.h>
6
7namespace sf
8{
9
13class _MISC_CLASS TitleBarButton : public QWidget
14{
15 Q_OBJECT
16
17 public:
21 explicit TitleBarButton(QWidget* parent = nullptr);
22
26 Q_SIGNAL void clicked();
27
31 void setImage(const QImage& img);
32
36 const QImage& image() const;
37
41 void setMargins(QMargins m);
42
46 QMargins margins() const;
47
48 protected:
52 void resizeEvent(QResizeEvent* event) override;
53
57 void paintEvent(QPaintEvent* event) override;
58
62 void mousePressEvent(QMouseEvent* event) override;
63
67 void enterEvent(QEnterEvent* event) override;
68
72 void leaveEvent(QEvent* event) override;
73
74 private:
75 QMargins _margins;
76 QImage _image;
77};
78
79}// namespace sf
Definition TitleBarButton.h:14
Q_SIGNAL void clicked()
Signal for when the image is clicked.
void mousePressEvent(QMouseEvent *event) override
Overridden from base class.
TitleBarButton(QWidget *parent=nullptr)
WQt default constructor.
void setImage(const QImage &img)
Sets the mage for this button.
void leaveEvent(QEvent *event) override
Overridden from base class.
void setMargins(QMargins m)
Sets the margins for image within the button.
const QImage & image() const
Gets the mage for this button.
void paintEvent(QPaintEvent *event) override
Overridden from base class.
void enterEvent(QEnterEvent *event) override
Overridden from base class.
QMargins margins() const
Sets the margins for image within the button.
void resizeEvent(QResizeEvent *event) override
Overridden from base class.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10