diff options
Diffstat (limited to '')
| -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; +} |
