diff --git a/src/Insight/UserInterfaces/InsightWindow/InsightWindow.cpp b/src/Insight/UserInterfaces/InsightWindow/InsightWindow.cpp index 45751c87..c3e466e0 100644 --- a/src/Insight/UserInterfaces/InsightWindow/InsightWindow.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/InsightWindow.cpp @@ -114,7 +114,7 @@ namespace Bloom auto* targetRegisterButtonLayout = this->targetRegistersButton->findChild(); auto* registersBtnLabel = new RotatableLabel(270, "Registers", this->targetRegistersButton); registersBtnLabel->setObjectName("target-registers-btn-label"); - registersBtnLabel->setContentsMargins(5,0,9,0); + registersBtnLabel->setContentsMargins(4, 3, 10, 0); targetRegisterButtonLayout->insertWidget(0, registersBtnLabel, 0, Qt::AlignTop); this->bottomMenuBar = this->container->findChild("bottom-menu-bar"); diff --git a/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.cpp b/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.cpp index 2fd81492..7fff910d 100644 --- a/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.cpp +++ b/src/Insight/UserInterfaces/InsightWindow/Widgets/RotatableLabel.cpp @@ -6,9 +6,10 @@ namespace Bloom::Widgets { void RotatableLabel::paintEvent(QPaintEvent* event) { auto painter = QPainter(this); - static auto containerSize = this->getContainerSize(); - static auto textSize = QLabel::minimumSizeHint(); - static auto margins = this->contentsMargins(); + const auto containerSize = this->getContainerSize(); + const auto textSize = QLabel::minimumSizeHint(); + const auto margins = this->contentsMargins(); + painter.setClipRect(0, 0, containerSize.width(), containerSize.height()); painter.save(); painter.setPen(Qt::PenStyle::SolidLine); @@ -16,8 +17,11 @@ namespace Bloom::Widgets painter.translate(std::ceil(containerSize.width() / 2), std::ceil(containerSize.height() / 2)); painter.rotate(this->angle); painter.drawText( - -(textSize.width() / 2) + margins.left(), - (textSize.height() / 2) + margins.top(), + -(containerSize.height() / 2) + margins.left(), + -(textSize.height() / 2) + margins.top(), + textSize.width(), + textSize.height(), + Qt::AlignTop, this->text() );