From eae33e9e0ff837561e25d977a1d6b0f36a16f509 Mon Sep 17 00:00:00 2001 From: Nav Date: Sat, 11 Mar 2023 21:09:36 +0000 Subject: [PATCH] Margin and angle properties for RotatableLabel widget --- .../InsightWindow/Widgets/RotatableLabel.hpp | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.hpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.hpp index 9a71fac6..fbf4f573 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.hpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.hpp @@ -9,6 +9,11 @@ namespace Bloom::Widgets class RotatableLabel: public Label { Q_OBJECT + Q_PROPERTY(int leftMargin READ getLeftMargin WRITE setLeftMargin DESIGNABLE true) + Q_PROPERTY(int rightMargin READ getRightMargin WRITE setRightMargin DESIGNABLE true) + Q_PROPERTY(int topMargin READ getTopMargin WRITE setTopMargin DESIGNABLE true) + Q_PROPERTY(int bottomMargin READ getBottomMargin WRITE setBottomMargin DESIGNABLE true) + Q_PROPERTY(int angle READ getAngle WRITE setAngle DESIGNABLE true) public: RotatableLabel(const QString& text, QWidget* parent) @@ -20,6 +25,50 @@ namespace Bloom::Widgets , angle(angleDegrees) {}; + int getLeftMargin() { + return this->contentsMargins().left(); + } + + void setLeftMargin(int leftMargin) { + auto margins = this->contentsMargins(); + margins.setLeft(leftMargin); + this->setContentsMargins(margins); + } + + int getRightMargin() { + return this->contentsMargins().right(); + } + + void setRightMargin(int rightMargin) { + auto margins = this->contentsMargins(); + margins.setRight(rightMargin); + this->setContentsMargins(margins); + } + + int getTopMargin() { + return this->contentsMargins().top(); + } + + void setTopMargin(int topMargin) { + auto margins = this->contentsMargins(); + margins.setTop(topMargin); + this->setContentsMargins(margins); + } + + int getBottomMargin() { + return this->contentsMargins().bottom(); + } + + void setBottomMargin(int bottomMargin) { + auto margins = this->contentsMargins(); + margins.setBottom(bottomMargin); + this->setContentsMargins(margins); + } + + int getAngle() { + return this->angle; + } + void setAngle(int angleDegrees) { this->angle = angleDegrees; }