本文整理汇总了C++中Q3ValueList::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3ValueList::remove方法的具体用法?C++ Q3ValueList::remove怎么用?C++ Q3ValueList::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3ValueList
的用法示例。
在下文中一共展示了Q3ValueList::remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: undo_mark_deleted
/*!
* Undo marks deleted current element or group (with subgroups).
* \param item (in) - marked deleted element or group item.
*/
void CatalogForm::undo_mark_deleted( Q3ListViewItem * item )
{
qulonglong id = getElementId(item);
if(id)
{
cat->select(id);
if(cat->First())
{
cat->setMarkDeletedElement(id,false);
item->setPixmap(0,getElementPixmap());
}
}
else
{
id = getGroupId(item);
if(id)
{
// cat->select(QString("id=%1").arg(id),md_group);
//if(cat->FirstInGroupTable())
Q3ValueList<qulonglong> listDeletedId;
// cat->setMarkDeletedGroup(id, listDeletedId,false);
cat->getMarkDeletedList(id, listDeletedId);
Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
while(it != listDeletedId.end()) //first delete elements in this group
{
if(map_el.contains(*it))
{
map_el[*it]->setPixmap(0, getElementPixmap());
cat->setMarkDeletedElement(*it,false);
it = listDeletedId.remove(it);
}
else
{
++it;
}
}
it = listDeletedId.begin();
while(it != listDeletedId.end()) //second delete groups
{
if(map_gr.contains(*it))
{
map_gr[*it]->setPixmap(0, getGroupPixmap());
cat->setMarkDeletedGroup(*it,false);
it = listDeletedId.remove(it);
//map_el[*it]->invalidateHeight();// setHeight(10);
}
else
{
++it;
}
}
}
}
}
示例2: mark_deleted
/*!
* Marks deleted current element or group (with subgroups).
* While for mark deleted items sets ahother pixmap only.
* \param item (in) - marked deleted element or group item.
*/
void CatalogForm::mark_deleted( Q3ListViewItem * item )
{
qulonglong id = getElementId(item);
if(id)
{
cat->select(id);
// cat->setSelected(true);
if(cat->First())
{
cat->setMarkDeletedElement(id,true);
item->setPixmap(0,getMarkDeletedPixmap());
}
}
else
{
id = getGroupId(item);
if(id)
{
loadElements(id); // populate items in group
Q3ValueList<qulonglong> listDeletedId;
cat->getMarkDeletedList(id,listDeletedId);
Q3ValueList<qulonglong>::iterator it = listDeletedId.begin();
while(it != listDeletedId.end()) //first delete elements in this group
{
if(map_el.contains(*it))
{
map_el[*it]->setPixmap(0, getMarkDeletedPixmap());
cat->setMarkDeletedElement(*it,true);
it = listDeletedId.remove(it);
}
else
{
++it;
}
}
it = listDeletedId.begin();
while(it != listDeletedId.end()) //second delete groups
{
if(map_gr.contains(*it))
{
map_gr[*it]->setPixmap(0, getMarkDeletedPixmap());
cat->setMarkDeletedGroup(*it,true);
it = listDeletedId.remove(it);
//map_el[*it]->invalidateHeight();// setHeight(10);
}
else
{
++it;
}
}
}
}
}
示例3: QCOMPARE
void tst_Q3ValueList::remove()
{
{
Q3ValueList<int> a;
a.append( 1 );
a.append( 10 );
a.append( 100 );
a.append( 1000 );
a.append( 1000 );
a.append( 10000 );
QCOMPARE( (uint)a.remove(100), (uint)1 );
QCOMPARE( (uint)a.remove(1000), (uint)2 );
QCOMPARE( (int)a.first(), 1 );
QCOMPARE( (int)a.last(), 10000 );
a.remove( a.at(0) );
QCOMPARE( (int)a.first(), 10 );
QCOMPARE( (int)a.last(), 10000 );
a.remove( a.at(1) );
QCOMPARE( (int)a.first(), 10 );
QCOMPARE( (int)a.last(), 10 );
}
{
Q3ValueList<int> a;
a.append( 1 );
a.append( 10 );
a.append( 100 );
a.append( 1000 );
a.append( 10000 );
Q3ValueList<int>::Iterator it = a.begin();
++it;
QVERIFY(*it == 10);
it = a.remove(it);
QVERIFY(*it == 100);
it = a.remove(it);
QVERIFY(*it == 1000);
it = a.remove(it);
QVERIFY(*it == 10000);
it = a.remove(it);
QVERIFY(it == a.end());
}
}
示例4: createDiet
void DietWizardDialog::createDiet( void )
{
KApplication::setOverrideCursor( Qt::WaitCursor );
START_TIMER("Creating the diet");
RecipeList rlist;
dietRList->clear();
// Get the whole list of recipes, detailed
int flags = RecipeDB::Title | getNecessaryFlags();
database->loadRecipes( &rlist, flags );
// temporal iterator list so elements can be removed without reloading them again from the DB
// this list prevents the same meal from showing up in the same day twice
Q3ValueList <RecipeList::Iterator> tempRList;
bool alert = false;
for ( int day = 0;day < dayNumber;day++ ) // Create the diet for the number of days defined by the user
{
populateIteratorList( rlist, &tempRList ); // temporal iterator list so elements can be removed without reloading them again from the DB
for ( int meal = 0;meal < mealNumber;meal++ )
{
int dishNo = ( ( MealInput* ) ( mealTabs->widget( meal ) ) ) ->dishNo();
for ( int dish = 0;dish < dishNo;dish++ ) {
bool found = false;
Q3ValueList <RecipeList::Iterator> tempDishRList = tempRList;
while ( ( !found ) && !tempDishRList.empty() ) {
int random_index = ( int ) ( ( float ) ( KRandom::random() ) / ( float ) RAND_MAX * tempDishRList.count() );
Q3ValueList<RecipeList::Iterator>::Iterator iit = tempDishRList.at( random_index ); // note that at() retrieves an iterator to the iterator list, so we need to use * in order to get the RecipeList::Iterator
RecipeList::Iterator rit = *iit;
if ( found = ( ( ( !categoryFiltering( meal, dish ) ) || checkCategories( *rit, meal, dish ) ) && checkConstraints( *rit, meal, dish ) ) ) // Check that the recipe is inside the constraint limits and in the categories specified
{
dietRList->append( *rit ); // Add recipe to the diet list
tempRList.remove( tempRList.find(*iit) ); //can't just remove()... the iterator isn't from this list (its an iterator from tempDishRList)
}
else {
tempDishRList.remove( iit ); // Remove this analized recipe from teh list
}
}
if ( !found )
alert = true;
}
}
}
if ( alert ) {
KApplication::restoreOverrideCursor();
KMessageBox::sorry( this, i18nc( "@info", "Given the constraints, a full diet list could not be constructed. Either the recipe list is too short or the constraints are too demanding. " ) );
}
else // show the resulting diet
{
// make a list of dishnumbers
QList<int> dishNumbers;
for ( int meal = 0;meal < mealNumber;meal++ ) {
int dishNo = ( ( MealInput* ) ( mealTabs->widget( meal ) ) ) ->dishNo();
dishNumbers << dishNo;
}
KApplication::restoreOverrideCursor();
// display the list
QPointer<DietViewDialog> dietDisplay = new DietViewDialog( this, *dietRList, dayNumber, mealNumber, dishNumbers );
connect( dietDisplay, SIGNAL( signalOk() ), this, SLOT( createShoppingList() ) );
dietDisplay->exec();
delete dietDisplay;
}
END_TIMER();
}