KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
frame.h
1#ifndef FRAME_H
2#define FRAME_H
3
4#include <QFrame>
5
6#include <Kanoop/utility/loggingbaseclass.h>
7#include <Kanoop/gui/libkanoopgui.h>
8
9/**
10 * @brief QFrame subclass with logging support and color Q_PROPERTYs.
11 *
12 * Frame exposes foregroundColor and backgroundColor as Qt properties,
13 * allowing them to be set from Qt Designer or stylesheets and causing the
14 * widget to repaint with the chosen colors.
15 */
16class LIBKANOOPGUI_EXPORT Frame : public QFrame,
17 public LoggingBaseClass
18{
19 Q_OBJECT
20 /** @brief Foreground (text) color of the frame. */
21 Q_PROPERTY(QColor foregroundColor READ foregroundColor WRITE setForegroundColor) // clazy:exclude=qproperty-without-notify
22 /** @brief Background color of the frame. */
23 Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor) // clazy:exclude=qproperty-without-notify
24public:
25 /**
26 * @brief Construct with an optional parent.
27 * @param parent Optional QWidget parent
28 */
29 explicit Frame(QWidget *parent = nullptr);
30
31 /**
32 * @brief Return the current foreground color.
33 * @return Foreground (text) color
34 */
35 QColor foregroundColor() const { return _foregroundColor; }
36
37 /**
38 * @brief Set the foreground color and repaint.
39 * @param color New foreground color
40 */
41 void setForegroundColor(const QColor& color);
42
43 /**
44 * @brief Return the current background color.
45 * @return Background color
46 */
47 QColor backgroundColor() const { return _backgroundColor; }
48
49 /**
50 * @brief Set the background color and repaint.
51 * @param color New background color
52 */
53 void setBackgroundColor(const QColor& color);
54
55private:
56 QColor _foregroundColor;
57 QColor _backgroundColor;
58};
59
60#endif // FRAME_H
QFrame subclass with logging support and color Q_PROPERTYs.
Definition frame.h:18
void setForegroundColor(const QColor &color)
Set the foreground color and repaint.
QColor backgroundColor() const
Return the current background color.
Definition frame.h:47
void setBackgroundColor(const QColor &color)
Set the background color and repaint.