From 54c67d86580bbd34ce33f0d139e0b7e9e683f328 Mon Sep 17 00:00:00 2001 From: Andilippi Date: Fri, 17 Oct 2025 22:02:25 +0100 Subject: [PATCH] UI Adjustments Improve theming ability: Move from QWidget to QFrame Add Object names for Colour and Clear button --- draw-dock.cpp | 10 ++++++++-- draw-dock.hpp | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/draw-dock.cpp b/draw-dock.cpp index 02c97bd..f45e5ca 100644 --- a/draw-dock.cpp +++ b/draw-dock.cpp @@ -189,7 +189,7 @@ void SetAlwaysOnTop(QWidget *window, bool enable) } #endif -DrawDock::DrawDock(QWidget *_parent) : QWidget(_parent), eventFilter(BuildEventFilter()), preview(new OBSQTDisplay(this)) +DrawDock::DrawDock(QWidget *_parent) : QFrame(_parent), eventFilter(BuildEventFilter()), preview(new OBSQTDisplay(this)) { auto ml = new QVBoxLayout(this); ml->setContentsMargins(0, 0, 0, 0); @@ -772,7 +772,13 @@ DrawDock::DrawDock(QWidget *_parent) : QWidget(_parent), eventFilter(BuildEventF #endif toolbar->addSeparator(); - toolbar->addAction(QString::fromUtf8(obs_module_text("Clear")), [this] { ClearDraw(); }); + clearAction = toolbar->addAction(QString::fromUtf8(obs_module_text("Clear")), [this] { ClearDraw(); }); + + // Set object names for theming support + if (auto *colorButton = toolbar->widgetForAction(colorAction)) + colorButton->setObjectName(QStringLiteral("drawColorButton")); + if (auto *clearButton = toolbar->widgetForAction(clearAction)) + clearButton->setObjectName(QStringLiteral("drawClearButton")); preview->setObjectName(QStringLiteral("preview")); preview->setMinimumSize(QSize(24, 24)); diff --git a/draw-dock.hpp b/draw-dock.hpp index 90d0e9b..18abbd5 100644 --- a/draw-dock.hpp +++ b/draw-dock.hpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -22,7 +23,7 @@ class OBSEventFilter : public QObject { EventFilterFunc filter; }; -class DrawDock : public QWidget { +class DrawDock : public QFrame { Q_OBJECT private: OBSEventFilter *eventFilter; @@ -37,6 +38,7 @@ class DrawDock : public QWidget { QComboBox *toolCombo; QAction *colorAction; QAction *imageAction; + QAction *clearAction; QDoubleSpinBox *toolSizeSpin; QDoubleSpinBox *alphaSpin; QCheckBox *eraseCheckbox;