Skip to content

Commit

Permalink
Button group signal fix
Browse files Browse the repository at this point in the history
  • Loading branch information
YakoYakoYokuYoku committed Dec 16, 2024
1 parent 0a8bdb4 commit 99be05f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Gui/ColorSelectorWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -646,8 +646,13 @@ ColorSelectorWidget::ColorSelectorWidget(bool withAlpha, QWidget *parent)
this, SLOT( handleSliderAMoved(double) ) );
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QObject::connect( _buttonColorGroup, SIGNAL( buttonClicked(QAbstractButton*) ),
this, SLOT( handleButtonColorClicked(QAbstractButton*) ) );
#else
QObject::connect( _buttonColorGroup, SIGNAL( buttonClicked(int) ),
this, SLOT( handleButtonColorClicked(int) ) );
#endif

QObject::connect( paletteAddColorButton, SIGNAL( clicked(bool) ),
this, SLOT( setPaletteButtonColor(bool) ) );
Expand Down Expand Up @@ -1226,6 +1231,16 @@ ColorSelectorWidget::setSliderVColor()
_slideV->setUseLineColor(true, color);
}

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void
ColorSelectorWidget::handleButtonColorClicked(QAbstractButton *button)
{
QVariant var = button->property(COLOR_SELECTOR_BUTTON_PROPERTY);
if ( var.isValid() ) {
_stack->setCurrentIndex( var.toInt() );
}
}
#else
void
ColorSelectorWidget::handleButtonColorClicked(int /*id*/)
{
Expand All @@ -1234,6 +1249,7 @@ ColorSelectorWidget::handleButtonColorClicked(int /*id*/)
_stack->setCurrentIndex( var.toInt() );
}
}
#endif

void
ColorSelectorWidget::setPaletteButtonColor(bool /*clicked*/)
Expand Down
4 changes: 4 additions & 0 deletions Gui/ColorSelectorWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ private Q_SLOTS:
void setSliderSColor();
void setSliderVColor();

#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void handleButtonColorClicked(QAbstractButton *button);
#else
void handleButtonColorClicked(int id);
#endif

void setPaletteButtonColor(bool clicked = true);
void clearPaletteButtons(bool clicked = true);
Expand Down

0 comments on commit 99be05f

Please sign in to comment.