[yast-commit] r39115 - /branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc
Author: sh-sh-sh Date: Mon Jul 2 17:21:08 2007 New Revision: 39115 URL: http://svn.opensuse.org/viewcvs/yast?rev=39115&view=rev Log: fixed selection Modified: branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc Modified: branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc?rev=39115&r1=39114&r2=39115&view=diff ============================================================================== --- branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc (original) +++ branches/tmp/sh/mod-ui/qt/src/YQSelectionBox.cc Mon Jul 2 17:21:08 2007 @@ -33,6 +33,7 @@ #include "YQDialog.h" #include "YUIException.h" +#define VERBOSE_SELECTION 1 #define DEFAULT_VISIBLE_LINES 5 #define SHRINKABLE_VISIBLE_LINES 2 @@ -63,14 +64,14 @@ _qt_listBox->setTopItem(0); _qt_label->setBuddy( _qt_listBox ); - if ( notify() ) - { - connect( _qt_listBox, SIGNAL( highlighted ( int ) ), - this, SLOT ( slotSelected( int ) ) ); + connect( _qt_listBox, SIGNAL( highlighted ( int ) ), + this, SLOT ( slotSelected( int ) ) ); - connect( _qt_listBox, SIGNAL( doubleClicked( QListBoxItem * ) ), - this, SLOT ( slotActivated( QListBoxItem * ) ) ); + connect( _qt_listBox, SIGNAL( doubleClicked( QListBoxItem * ) ), + this, SLOT ( slotActivated( QListBoxItem * ) ) ); + if ( notify() ) + { connect( &_timer, SIGNAL( timeout() ), this, SLOT ( returnImmediately() ) ); } @@ -160,7 +161,16 @@ YItem * item = YSelectionWidget::itemAt( index ); if ( item ) + { +#ifdef VERBOSE_SELECTION + y2debug( "%s \"%s\": Selecting item \"%s\"", + widgetClass(), + debugLabel().c_str(), + item->label().c_str() ); +#endif + item->setSelected( true ); + } else YUI_THROW( YUIException( "Can't find selected item" ) ); } @@ -275,24 +285,27 @@ { selectItem( index ); - if ( immediateMode() ) - returnImmediately(); - else + if ( notify() ) { - if ( ! YQUI::ui()->eventsBlocked() ) + if ( immediateMode() ) + returnImmediately(); + else { - // Delayed event delivery - only if events are to be delivered - // right now. - // - // An event block that is in effect right now may or may not affect - // events after the timer delay is expired. - // - // This may create nasty side effects such as bug #32510: When an - // item is initially selected, that initial selection event gets - // through even though (!) events are blocked during widget - // creation. + if ( ! YQUI::ui()->eventsBlocked() ) + { + // Delayed event delivery - only if events are to be delivered + // right now. + // + // An event block that is in effect right now may or may not affect + // events after the timer delay is expired. + // + // This may create nasty side effects such as bug #32510: When an + // item is initially selected, that initial selection event gets + // through even though (!) events are blocked during widget + // creation. - returnDelayed(); + returnDelayed(); + } } } } @@ -300,24 +313,10 @@ void YQSelectionBox::slotActivated( QListBoxItem * qItem ) { - YItem * item = itemAt( _qt_listBox->index( qItem ) ); + selectItem( _qt_listBox->index( qItem ) ); - if ( item ) - { -#if 1 - y2debug( "Item %s selected", item->label().c_str() ); -#endif - YSelectionBox::deselectAllItems(); - item->setSelected( true ); - + if ( notify() ) YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::Activated ) ); - } - else - { - y2error( "%s: No YItem %s found", - debugLabel().c_str(), - toUTF8( qItem->text() ).c_str() ); - } } -- 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