Adding frame highlighting individual macro segments

This commit is contained in:
WarmUpTill
2022-01-30 02:48:12 +01:00
committed by WarmUpTill
parent 727992f1d0
commit e13f20c860
5 changed files with 21 additions and 13 deletions

View File

@@ -1,6 +1,8 @@
#pragma once
#include <QWidget>
#include <QTimer>
#include <QFrame>
#include <QVBoxLayout>
#include <obs.hpp>
class Macro;
@@ -69,6 +71,8 @@ protected:
Section *_section;
QLabel *_headerInfo;
MacroEntryControls *_controls;
QFrame *_frame;
QVBoxLayout *_highLightFrameLayout;
private:
QTimer _enterTimer;

View File

@@ -78,18 +78,9 @@ MacroActionEdit::MacroActionEdit(QWidget *parent,
_section->AddHeaderWidget(_actionSelection);
_section->AddHeaderWidget(_headerInfo);
auto frame = new QFrame;
frame->setObjectName("actionFrame");
frame->setStyleSheet(
"#actionFrame { border-radius: 4px; background-color: rgba(0,0,0,50); }");
setStyleSheet("QCheckBox { background-color: rgba(0,0,0,0); }\
QLabel { background-color: rgba(0,0,0,0); }");
QVBoxLayout *frameLayout = new QVBoxLayout;
frame->setLayout(frameLayout);
frameLayout->addWidget(_section);
QVBoxLayout *actionLayout = new QVBoxLayout;
actionLayout->addWidget(frame);
actionLayout->addWidget(_frame);
_highLightFrameLayout->addWidget(_section);
QHBoxLayout *mainLayout = new QHBoxLayout;
if (switcher->useVerticalMacroControls) {

View File

@@ -123,7 +123,8 @@ MacroConditionEdit::MacroConditionEdit(
_section->AddHeaderWidget(_dur);
QVBoxLayout *conditionLayout = new QVBoxLayout;
conditionLayout->addWidget(_section);
conditionLayout->addWidget(_frame);
_highLightFrameLayout->addWidget(_section);
QHBoxLayout *mainLayout = new QHBoxLayout;
if (switcher->useVerticalMacroControls) {

View File

@@ -52,6 +52,17 @@ MacroSegmentEdit::MacroSegmentEdit(bool verticalControls, QWidget *parent)
_leaveTimer.setSingleShot(true);
_leaveTimer.setInterval(1000);
_frame = new QFrame;
_frame->setObjectName("segmentFrame");
_highLightFrameLayout = new QVBoxLayout;
_frame->setStyleSheet(
"#segmentFrame { border-radius: 4px; background-color: rgba(0,0,0,50); }");
_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); }");
QWidget::connect(_section, &Section::Collapsed, this,
&MacroSegmentEdit::Collapsed);

View File

@@ -12,7 +12,8 @@ Section::Section(const int animationDuration, QWidget *parent)
_mainLayout = new QGridLayout(this);
_headerWidgetLayout = new QHBoxLayout();
_toggleButton->setStyleSheet("QToolButton {border: none;}");
_toggleButton->setStyleSheet(
"QToolButton {border: none; background-color: rgba(0,0,0,0);}");
_toggleButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
_toggleButton->setArrowType(Qt::ArrowType::RightArrow);
_toggleButton->setCheckable(true);