本文整理汇总了C++中Q3ValueList::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3ValueList::empty方法的具体用法?C++ Q3ValueList::empty怎么用?C++ Q3ValueList::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3ValueList
的用法示例。
在下文中一共展示了Q3ValueList::empty方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QVERIFY
void tst_Q3ValueList::isEmpty()
{
Q3ValueList<int> a;
QVERIFY( a.isEmpty() );
QVERIFY( a.empty() );
a.append( 1 );
QVERIFY( !a.isEmpty() );
QVERIFY( !a.empty() );
}
示例2: 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();
}