[yast-commit] r47241 - in /trunk/qt: VERSION.cmake package/yast2-qt.changes src/YQRadioButton.cc src/YQRadioButtonGroup.cc src/YQRadioButtonGroup.h
Author: sh-sh-sh Date: Wed Apr 30 17:43:52 2008 New Revision: 47241 URL: http://svn.opensuse.org/viewcvs/yast?rev=47241&view=rev Log: Fixed bnc #379904: More than one radio button checked Modified: trunk/qt/VERSION.cmake trunk/qt/package/yast2-qt.changes trunk/qt/src/YQRadioButton.cc trunk/qt/src/YQRadioButtonGroup.cc trunk/qt/src/YQRadioButtonGroup.h Modified: trunk/qt/VERSION.cmake URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/VERSION.cmake?rev=47241&r1=47240&r2=47241&view=diff ============================================================================== --- trunk/qt/VERSION.cmake (original) +++ trunk/qt/VERSION.cmake Wed Apr 30 17:43:52 2008 @@ -1,3 +1,3 @@ SET(VERSION_MAJOR "2") SET(VERSION_MINOR "16") -SET(VERSION_PATCH "44") +SET(VERSION_PATCH "45") Modified: trunk/qt/package/yast2-qt.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/package/yast2-qt.changes?rev=47241&r1=47240&r2=47241&view=diff ============================================================================== --- trunk/qt/package/yast2-qt.changes (original) +++ trunk/qt/package/yast2-qt.changes Wed Apr 30 17:43:52 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Apr 30 17:43:03 CEST 2008 - sh@suse.de + +- Fixed bnc #379904: More than one radio button checked +- V 2.16.45 + +------------------------------------------------------------------- Tue Apr 29 17:05:40 CEST 2008 - sh@suse.de - Fixed bnc #383672 - Busy cursor in file dialogs Modified: trunk/qt/src/YQRadioButton.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQRadioButton.cc?rev=47241&r1=47240&r2=47241&view=diff ============================================================================== --- trunk/qt/src/YQRadioButton.cc (original) +++ trunk/qt/src/YQRadioButton.cc Wed Apr 30 17:43:52 2008 @@ -50,6 +50,12 @@ { setWidgetRep( this ); + // QRadioButton uses its own logic by default to make sure that only one + // button of a radio box is checked at any time, but this interferes with + // YRadioButtonGroup. Let YRadioButtonGroup and YQRadioButton::changed() + // handle this. + setAutoExclusive( false ); + setChecked( checked ); installEventFilter(this); @@ -98,6 +104,7 @@ { YQSignalBlocker sigBlocker( this ); + // yuiDebug() << "Setting " << this << (newValue ? " on" : " off") << endl; setChecked( newValue ); if ( newValue ) @@ -132,12 +139,19 @@ } -// slots - void YQRadioButton::changed( bool newState ) { - if ( notify() && newState ) - YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ValueChanged ) ); + if ( newState ) + { + yuiDebug() << "User set " << this << ( newState ? " on" : " off" ) << endl; + YRadioButtonGroup * group = buttonGroup(); + + if ( group ) + group->uncheckOtherButtons( this ); + + if ( notify() ) + YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ValueChanged ) ); + } } Modified: trunk/qt/src/YQRadioButtonGroup.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQRadioButtonGroup.cc?rev=47241&r1=47240&r2=47241&view=diff ============================================================================== --- trunk/qt/src/YQRadioButtonGroup.cc (original) +++ trunk/qt/src/YQRadioButtonGroup.cc Wed Apr 30 17:43:52 2008 @@ -23,12 +23,12 @@ #include "YQRadioButtonGroup.h" #include "YQRadioButton.h" +#include "qstring.h" YQRadioButtonGroup::YQRadioButtonGroup( YWidget * parent ) : QWidget( (QWidget *) parent->widgetRep() ) , YRadioButtonGroup( parent ) - , _recursive( false ) { setWidgetRep( this ); } @@ -47,13 +47,8 @@ if ( button->value() ) // if this new button is active { - uncheckOtherButtons( button ); // make it the only active + uncheckOtherButtons( button ); // make it the only active one } - - QRadioButton * radio_button = dynamic_cast<YQRadioButton *>( button ); - - connect ( radio_button, SIGNAL ( toggled ( bool ) ), - this, SLOT ( radioButtonClicked( bool ) ) ); } @@ -73,47 +68,4 @@ } -void -YQRadioButtonGroup::radioButtonClicked( bool newState ) -{ - // Prevent infinite recursion: YQRadioButton::setValue() might cause Qt - // signals that would cause recursion to this place. - - if ( _recursive ) - return; - - _recursive = true; - - QRadioButton * senderButton = (QRadioButton *) sender(); - - // Implement radio box behaviour: Uncheck all other radio buttons - - for ( YRadioButtonListConstIterator it = radioButtonsBegin(); - it != radioButtonsEnd(); - ++it ) - { - YQRadioButton * radioButton = dynamic_cast<YQRadioButton *> (*it); - - if ( radioButton ) - { - if ( radioButton == senderButton ) - { - // If this button has been clicked, it is to be the RadioBox's - // active button - regardless of newState. This is to avoid - // RadioBoxes where no single button is active; otherwise the - // second click would deactivate the only active button. - - radioButton->setValue( true ); - } - else - { - radioButton->setValue( false ); - } - } - } - - _recursive = false; -} - - #include "YQRadioButtonGroup.moc" Modified: trunk/qt/src/YQRadioButtonGroup.h URL: http://svn.opensuse.org/viewcvs/yast/trunk/qt/src/YQRadioButtonGroup.h?rev=47241&r1=47240&r2=47241&view=diff ============================================================================== --- trunk/qt/src/YQRadioButtonGroup.h (original) +++ trunk/qt/src/YQRadioButtonGroup.h Wed Apr 30 17:43:52 2008 @@ -58,24 +58,6 @@ * Reimplemented from YWidget. **/ virtual void setSize( int newWidth, int newHeight ); - - -private slots: - - /** - * Triggered when one of the radio buttons changed state. - * This implements the radio box behaviour, i.e. unselects all but the last - * selected radio button. - **/ - void radioButtonClicked( bool newState ); - - -private: - - /** - * Used to prevent infinite recursion due to signal race conditions. - **/ - bool _recursive; }; -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
sh-sh-sh@svn.opensuse.org