Bugs in KComboBox

Andrew Coles andrew_coles at yahoo.co.uk
Thu Nov 11 16:06:07 GMT 2004


On Thursday 11 Nov 2004 15:48, Waldo Bastian wrote:
> > Solution - ditch the call to removeItem(i) and call clear() after the for
> > loop has completed.
>
> That would ignore the if ( text( i ) == item ) test.

Phew, I thought I'd ask as I had a feeling it would be subtly broken even 
though I couldn't see  where myself....

So using:

int i = 0;
while (i < count() ) {
 if ( text( i ) == item ) {
  if ( !wasCurrent )
   wasCurrent = ( i == currentItem() );
  removeItem( i );
 } else {
  ++i;
 }
}

would be a valid fix then, i.e. respects the (text(i) == item) test.

Thanks for the pointers,

Andrew




More information about the kde-core-devel mailing list