diff --git a/include/GroupBox.h b/include/GroupBox.h index 6a8f424f9..fdeb31c4d 100644 --- a/include/GroupBox.h +++ b/include/GroupBox.h @@ -50,6 +50,21 @@ public: return m_led; } + /** + * @brief Returns whether the LED button is shown or not + * + * @return true LED button is shown + * @return false LED button is hidden + */ + bool ledButtonShown() const; + + /** + * @brief Sets if the LED check box is shown or not + * + * @param value Set to true to show the LED check box or to false to hide it. + */ + void setLedButtonShown(bool value); + int titleBarHeight() const { return m_titleBarHeight; diff --git a/src/gui/instrument/InstrumentMidiIOView.cpp b/src/gui/instrument/InstrumentMidiIOView.cpp index fd9d6fc54..e321d061e 100644 --- a/src/gui/instrument/InstrumentMidiIOView.cpp +++ b/src/gui/instrument/InstrumentMidiIOView.cpp @@ -145,6 +145,7 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : } auto baseVelocityGroupBox = new GroupBox(tr("CUSTOM BASE VELOCITY")); + baseVelocityGroupBox->setLedButtonShown(false); layout->addWidget( baseVelocityGroupBox ); auto baseVelocityLayout = new QVBoxLayout(baseVelocityGroupBox); @@ -160,12 +161,8 @@ InstrumentMidiIOView::InstrumentMidiIOView( QWidget* parent ) : m_baseVelocitySpinBox = new LcdSpinBox( 3, baseVelocityGroupBox ); m_baseVelocitySpinBox->setLabel( tr( "BASE VELOCITY" ) ); - m_baseVelocitySpinBox->setEnabled( false ); baseVelocityLayout->addWidget( m_baseVelocitySpinBox ); - connect( baseVelocityGroupBox->ledButton(), SIGNAL(toggled(bool)), - m_baseVelocitySpinBox, SLOT(setEnabled(bool))); - layout->addStretch(); } diff --git a/src/gui/widgets/GroupBox.cpp b/src/gui/widgets/GroupBox.cpp index b5187de25..e3e71a812 100644 --- a/src/gui/widgets/GroupBox.cpp +++ b/src/gui/widgets/GroupBox.cpp @@ -72,13 +72,23 @@ void GroupBox::modelChanged() } +bool GroupBox::ledButtonShown() const +{ + return m_led->isVisible(); +} + + +void GroupBox::setLedButtonShown(bool value) +{ + m_led->setVisible(value); +} void GroupBox::mousePressEvent( QMouseEvent * _me ) { - if( _me->y() > 1 && _me->y() < 13 && _me->button() == Qt::LeftButton ) + if (ledButtonShown() && _me->y() > 1 && _me->y() < 13 && _me->button() == Qt::LeftButton) { - model()->setValue( !model()->value() ); + model()->setValue(!model()->value()); } } @@ -102,7 +112,9 @@ void GroupBox::paintEvent( QPaintEvent * pe ) // draw text p.setPen( palette().color( QPalette::Active, QPalette::Text ) ); p.setFont( pointSize<8>( font() ) ); - p.drawText( 22, m_titleBarHeight, m_caption ); + + int const captionX = ledButtonShown() ? 22 : 6; + p.drawText(captionX, m_titleBarHeight, m_caption); }