void tst_Q3ValueList::findIndex() { Q3ValueList<int> a; a.append( 1 ); a.append( 10 ); a.append( 100 ); a.append( 1000 ); a.append( 1000 ); QCOMPARE( a.findIndex( 0 ), -1 ); QCOMPARE( a.findIndex( 1 ), 0 ); QCOMPARE( a.findIndex( 1000 ), 3 ); }
/*! * Gets element id. * \param item (in) - element item. */ qulonglong CatalogForm::getElementId( Q3ListViewItem * item ) { Q3ValueList<Q3ListViewItem*> lst = map_el.values(); int ind = lst.findIndex(item); qulonglong key=0; if(ind!=-1) { Q3ValueList<qulonglong> listKey = map_el.keys(); key = listKey[ind]; } return key; }
/*! * Loads elemens in group, if then don't loaded. * \param item (in) - group for load. */ void CatalogForm::onLoadElements( Q3ListViewItem *item ) { Q3ValueList<Q3ListViewItem*> lst = map_gr.values(); int ind = lst.findIndex(item); qulonglong key; if(ind!=-1) { Q3ValueList<qulonglong> listKey = map_gr.keys(); key = listKey[ind]; loadElements(key); } }