aboutsummaryrefslogtreecommitdiff
path: root/src/qt/guiutil.h
diff options
context:
space:
mode:
authorHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-04-08 14:27:14 +0300
committerHennadii Stepanov <32963518+hebasto@users.noreply.github.com>2021-05-01 15:07:10 +0300
commitd99ef327a885874fed1c4e35e0f47b10290c6bd9 (patch)
tree2bb07f9c8daef56dc4b00549421738de68985845 /src/qt/guiutil.h
parentc054720e08b5549913f54b9b4bc4e4002617ff23 (diff)
downloadbitcoin-d99ef327a885874fed1c4e35e0f47b10290c6bd9.tar.xz
qt: Add GUIUtil::ThemedLabel class
The ThemedLabel class correctly handles appearance changes on macOS.
Diffstat (limited to 'src/qt/guiutil.h')
-rw-r--r--src/qt/guiutil.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/qt/guiutil.h b/src/qt/guiutil.h
index a1cf274354..31e7aa7335 100644
--- a/src/qt/guiutil.h
+++ b/src/qt/guiutil.h
@@ -27,6 +27,7 @@
#include <chrono>
#include <utility>
+class PlatformStyle;
class QValidatedLineEdit;
class SendCoinsRecipient;
@@ -221,6 +222,25 @@ namespace GUIUtil
qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize = 4, qreal startPointSize = 14);
+ class ThemedLabel : public QLabel
+ {
+ Q_OBJECT
+
+ public:
+ explicit ThemedLabel(const PlatformStyle* platform_style, QWidget* parent = nullptr);
+ void setThemedPixmap(const QString& image_filename, int width, int height);
+
+ protected:
+ void changeEvent(QEvent* e) override;
+
+ private:
+ const PlatformStyle* m_platform_style;
+ QString m_image_filename;
+ int m_pixmap_width;
+ int m_pixmap_height;
+ void updateThemedPixmap();
+ };
+
class ClickableLabel : public QLabel
{
Q_OBJECT