void QtxListResourceEdit::SelectItem::store()
{
int idx = myList->currentItem();
- if ( myIndex.contains( idx ) )
- setInteger( myIndex[idx] );
+ if ( idx >= 0 )
+ setInteger( myIndex.contains( idx ) ? myIndex[idx] : idx );
}
/*!
{
int id = getInteger( -1 );
- int idx = -1;
- for ( QMap<int, int>::ConstIterator it = myIndex.begin(); it != myIndex.end() && idx == -1; ++it )
+ for ( QMap<int, int>::ConstIterator it = myIndex.begin(); it != myIndex.end(); ++it )
{
- if ( it.data() == id )
- idx = it.key();
+ if ( it.data() == id ) {
+ myList->setCurrentItem( it.key() );
+ return;
+ }
}
-
- myList->setCurrentItem( idx );
+ if ( id >= 0 )
+ myList->setCurrentItem( id );
}
/*!
virtual void update();
- QVariant property( const QString& ) const;
+ virtual QVariant property( const QString& ) const;
virtual void setProperty( const QString&, const QVariant& );
virtual void store() = 0;