From 99be05ff22c6de2d0e12a4f14d271f2ea244fae0 Mon Sep 17 00:00:00 2001 From: Martin Rodriguez Reboredo Date: Sat, 14 Dec 2024 01:01:23 -0300 Subject: [PATCH] Button group signal fix --- Gui/ColorSelectorWidget.cpp | 16 ++++++++++++++++ Gui/ColorSelectorWidget.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/Gui/ColorSelectorWidget.cpp b/Gui/ColorSelectorWidget.cpp index a2b4e023c..c46d55989 100644 --- a/Gui/ColorSelectorWidget.cpp +++ b/Gui/ColorSelectorWidget.cpp @@ -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) ) ); @@ -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*/) { @@ -1234,6 +1249,7 @@ ColorSelectorWidget::handleButtonColorClicked(int /*id*/) _stack->setCurrentIndex( var.toInt() ); } } +#endif void ColorSelectorWidget::setPaletteButtonColor(bool /*clicked*/) diff --git a/Gui/ColorSelectorWidget.h b/Gui/ColorSelectorWidget.h index 4cab7bbbb..3d8b89083 100644 --- a/Gui/ColorSelectorWidget.h +++ b/Gui/ColorSelectorWidget.h @@ -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);