Debian Codegraph @

src/Gui/QSint/actionpanel/actionlabel.h

raw
1 // SPDX-License-Identifier: LGPL-3.0-only
2 /***************************************************************************
3 * *
4 * Copyright: https://code.google.com/p/qsint/ *
5 * License: LGPL *
6 * *
7 ***************************************************************************/
8
9 #ifndef ACTIONLABEL_H
10 #define ACTIONLABEL_H
11
12 #include <QToolButton>
13 #include "qsint_global.h"
14
15 namespace QSint
16 {
17 /**
18 * @brief Represents an action, similar to a Windows Vista/7 control panel item.
19 *
20 * An ActionLabel typically displays an icon and text. It supports tooltips, status tips,
21 * clickability, checkability, and other features similar to a QToolButton.
22 *
23 * Customization via CSS: The class name `QSint--ActionLabel` is used.
24 */
25 class QSINT_EXPORT ActionLabel : public QToolButton
26 {
27 Q_OBJECT
28
29 public:
30 /**
31 * @brief Constructs an ActionLabel.
32 * @param parent The parent widget.
33 */
34 explicit ActionLabel(QWidget *parent = nullptr);
35
36 /**
37 * @brief Constructs an ActionLabel from a QAction.
38 * @param action The QAction to represent.
39 * @param parent The parent widget.
40 */
41 explicit ActionLabel(QAction *action, QWidget *parent = nullptr);
42
43 /**
44 * @brief Destroys the ActionLabel.
45 */
46 ~ActionLabel() override = default;
47
48 /**
49 * @brief Returns the recommended size for the label.
50 * @return The size hint.
51 */
52 QSize sizeHint() const override;
53
54 /**
55 * @brief Returns the minimum size the label can be.
56 * @return The minimum size hint.
57 */
58 QSize minimumSizeHint() const override;
59
60 private:
61 void paintEvent(QPaintEvent *event) override;
62
63 protected:
64 /**
65 * @brief Initializes the ActionLabel.
66 */
67 void init();
68 };
69
70 } // namespace
71
72 #endif // ACTIONLABEL_H