Commit 2d235298 authored by Jakob Leben's avatar Jakob Leben

qt4: selector: switch source on single click

parent 4d19752c
...@@ -54,12 +54,15 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf ) ...@@ -54,12 +54,15 @@ PLSelector::PLSelector( QWidget *p, intf_thread_t *_p_intf )
// view->setDropIndicatorShown(true); // view->setDropIndicatorShown(true);
createItems(); createItems();
CONNECT( view, itemActivated( QTreeWidgetItem *, int ), /* CONNECT( view, itemActivated( QTreeWidgetItem *, int ),
this, setSource( QTreeWidgetItem *) );
/* I believe this is unnecessary, seeing
QStyle::SH_ItemView_ActivateItemOnSingleClick
CONNECT( view, itemClicked( QTreeWidgetItem *, int ),
this, setSource( QTreeWidgetItem *) ); */ this, setSource( QTreeWidgetItem *) ); */
/* I believe this is unnecessary, seeing
QStyle::SH_ItemView_ActivateItemOnSingleClick */
/* <jleben> No, you can only make custom styles by creating whole new
or subclassing an existing QStyle.
Connecting itemClicked signal is easier, of course */
CONNECT( view, itemClicked( QTreeWidgetItem *, int ),
this, setSource( QTreeWidgetItem *) );
QVBoxLayout *layout = new QVBoxLayout; QVBoxLayout *layout = new QVBoxLayout;
layout->setSpacing( 0 ); layout->setMargin( 0 ); layout->setSpacing( 0 ); layout->setMargin( 0 );
...@@ -75,7 +78,10 @@ void PLSelector::setSource( QTreeWidgetItem *item ) ...@@ -75,7 +78,10 @@ void PLSelector::setSource( QTreeWidgetItem *item )
if( !item ) if( !item )
return; return;
int i_type = item->data( 0, TYPE_ROLE ).toInt(); QVariant type = item->data( 0, TYPE_ROLE );
if( type == QVariant() ) return;
int i_type = type.toInt();
assert( ( i_type == PL_TYPE || i_type == ML_TYPE || i_type == SD_TYPE ) ); assert( ( i_type == PL_TYPE || i_type == ML_TYPE || i_type == SD_TYPE ) );
if( i_type == SD_TYPE ) if( i_type == SD_TYPE )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment