diff options
| author | Akshay Nair <phenax5@gmail.com> | 2025-07-25 18:56:49 +0530 |
|---|---|---|
| committer | Akshay Nair <phenax5@gmail.com> | 2025-07-25 18:56:49 +0530 |
| commit | 2c7d36b4aa53ffa638a7aa7046767f10e7a152bf (patch) | |
| tree | 679c34d6566f5a774bcd5f979af755cf3cfeac4f /src/widgets/Decorations.cpp | |
| parent | 51be15cd7c9f39276f27d416356744041e62c22c (diff) | |
| download | null-browser-2c7d36b4aa53ffa638a7aa7046767f10e7a152bf.tar.gz null-browser-2c7d36b4aa53ffa638a7aa7046767f10e7a152bf.zip | |
Expose decorations enable/disable lua api
Diffstat (limited to 'src/widgets/Decorations.cpp')
| -rw-r--r-- | src/widgets/Decorations.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/widgets/Decorations.cpp b/src/widgets/Decorations.cpp index 659f972..d559776 100644 --- a/src/widgets/Decorations.cpp +++ b/src/widgets/Decorations.cpp @@ -1,10 +1,12 @@ #include <QWidget> #include <QtCore> +#include <optional> #include <qboxlayout.h> #include <qlabel.h> #include <qwidget.h> #include "Decorations.hpp" +#include "widgets/EdgeDecoration.hpp" Decorations::Decorations(QWidget *content_widget, QWebEngineProfile *profile, QWidget *parent) : QWidget(parent) { @@ -20,7 +22,7 @@ Decorations::Decorations(QWidget *content_widget, QWebEngineProfile *profile, QW </div> )HTML"; decoration_bottom->set_html(content); - decoration_bottom->set_enabled(true); + // decoration_bottom->set_enabled(true); auto *vbox = new QVBoxLayout(); vbox->setContentsMargins(0, 0, 0, 0); @@ -41,3 +43,24 @@ Decorations::Decorations(QWidget *content_widget, QWebEngineProfile *profile, QW hbox->addWidget(content_widget); hbox->addWidget(decoration_right); } + +void Decorations::set_enabled(DecorationType type, bool enabled) { + std::optional<EdgeDecoration *> decoration = get_decoration_widget(type); + + if (decoration.has_value()) + decoration.value()->set_enabled(enabled); +} + +std::optional<EdgeDecoration *> Decorations::get_decoration_widget(DecorationType type) { + switch (type) { + case DecorationType::DecorationTop: + return decoration_top; + case DecorationType::DecorationBottom: + return decoration_bottom; + case DecorationType::DecorationLeft: + return decoration_left; + case DecorationType::DecorationRight: + return decoration_right; + } + return nullptr; +} |
