From 1054bce4a7ec766d6486509171a476812a01cbe8 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Sun, 20 Feb 2022 20:01:37 +0100 Subject: [PATCH] Remove slight movement of macro segment when (de-)selecting them --- src/macro-segment.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/macro-segment.cpp b/src/macro-segment.cpp index 2a621621..71eec564 100644 --- a/src/macro-segment.cpp +++ b/src/macro-segment.cpp @@ -48,13 +48,12 @@ MacroSegmentEdit::MacroSegmentEdit(QWidget *parent) : QWidget(parent) _frame = new QFrame; _frame->setObjectName("segmentFrame"); _highLightFrameLayout = new QVBoxLayout; - _frame->setStyleSheet( - "#segmentFrame { border-radius: 4px; background-color: rgba(0,0,0,50); }"); + SetSelected(false); _frame->setLayout(_highLightFrameLayout); // Set background transparent to avoid blocking highlight frame - setStyleSheet("QCheckBox { background-color: rgba(0,0,0,0); }\ - QLabel { background-color: rgba(0,0,0,0); } \ - QSlider { background-color: rgba(0,0,0,0); }"); + setStyleSheet("QCheckBox { background-color: rgba(0,0,0,0); }" + "QLabel { background-color: rgba(0,0,0,0); }" + "QSlider { background-color: rgba(0,0,0,0); }"); // Keep the size of macro segments consistent, even if there is room in // the edit areas @@ -126,10 +125,20 @@ void MacroSegmentEdit::SetCollapsed(bool collapsed) void MacroSegmentEdit::SetSelected(bool selected) { if (selected) { - _frame->setStyleSheet( - "#segmentFrame { border-width: 2px; border-style: dashed; border-radius: 4px; background-color: rgba(0,0,0,100); }"); + _frame->setStyleSheet("#segmentFrame {" + "border-color: rgba(0, 0, 0, 255);" + "border-width: 2px;" + "border-style: dashed;" + "border-radius: 4px;" + "background-color: rgba(0,0,0,100);" + "}"); } else { - _frame->setStyleSheet( - "#segmentFrame { border-style: none; border-radius: 4px; background-color: rgba(0,0,0,50); }"); + _frame->setStyleSheet("#segmentFrame {" + "border-color: rgba(0, 0, 0, 0);" + "border-width: 2px;" + "border-style: dashed;" + "border-radius: 4px;" + "background-color: rgba(0,0,0,50);" + "}"); } }