本文整理汇总了C++中Q3ValueList::at方法的典型用法代码示例。如果您正苦于以下问题:C++ Q3ValueList::at方法的具体用法?C++ Q3ValueList::at怎么用?C++ Q3ValueList::at使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Q3ValueList
的用法示例。
在下文中一共展示了Q3ValueList::at方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: utilities
void UmlClass::utilities()
{
TRACE_FUNCTION;
const Q3PtrVector<UmlItem> ch = children();
bool have_constructor = FALSE;
bool have_destructor = FALSE;
Q3CString destr = "~" + name();
bool have_copy = FALSE;
bool have_const_copy = FALSE;
bool have_assignment = FALSE;
bool have_const_assignment = FALSE;
for (unsigned i = 0; i != ch.size(); i += 1) {
if (ch[i]->kind() == anOperation) { //[rageek] literal comparison
Q3CString s = ch[i]->name(); //[rageek]
if (s == name()) {
// may be a constructor or a copy constructor
const Q3ValueList<UmlParameter> params =
((UmlOperation *) ch[i])->params();
if (params.count() == 1) {
const UmlParameter & param = *(params.at(0));
if (param.type.type == this) {
if (param.dir == InputDirection)
have_const_copy = TRUE;
else
have_copy = TRUE;
}
else
have_constructor = TRUE;
}
else
have_constructor = TRUE;
}
else if (s == destr)
have_destructor = TRUE;
else if (s == "operator=") {
const Q3ValueList<UmlParameter> params =
((UmlOperation *) ch[i])->params();
if (params.count() == 1) {
if ((*(params.at(0))).dir == InputDirection)
have_const_assignment = TRUE;
else
have_assignment = TRUE;
}
}
}
}
ConstrDestrCopyDialog d(this, have_constructor, have_destructor,
have_copy, have_const_copy,
have_assignment, have_const_assignment);
d.exec();
}