本文整理汇总了C++中QueueItem::itemBelow方法的典型用法代码示例。如果您正苦于以下问题:C++ QueueItem::itemBelow方法的具体用法?C++ QueueItem::itemBelow怎么用?C++ QueueItem::itemBelow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueueItem
的用法示例。
在下文中一共展示了QueueItem::itemBelow方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: btnMoveBottom_clicked
void QueueDialog::btnMoveBottom_clicked()
{
QueueItem* current = (QueueItem*) getCurrentList()->selectedItem();
if(current == 0)
return;
if(current->getPriority() == 0)
return;
QueueItem* previous = (QueueItem*) current->itemBelow();
if(previous == 0)
return;
if(previous->getPriority() == 0)
return;
int p = previous->getPriority();
while(previous != 0 && previous->getPriority() != 0)
{
p = previous->getPriority();
previous->setPriority(p + 1);
previous = (QueueItem*) previous->itemBelow();
}
current->setPriority(p);
getCurrentList()->sort();
}
示例2: enqueue
void QueueDialog::enqueue(QueueItem* curr)
{
QueueItem* current = curr == 0 ? (QueueItem*) getCurrentList()->selectedItem() : curr;
if(current == 0)
return;
if(current->getPriority() != 0)
return;
QueueItem* item = (QueueItem*) getCurrentList()->firstChild();
if(item == 0)
return;
while(item != 0)
{
if(item->getPriority() != 0)
item->setPriority(item->getPriority() + 1);
item = (QueueItem*) item->itemBelow();
}
current->setPriority(1);
getCurrentList()->sort();
}
示例3: btnMoveDown_clicked
void QueueDialog::btnMoveDown_clicked()
{
QueueItem* current = (QueueItem*) getCurrentList()->selectedItem();
if(current == 0)
return;
if(current->getPriority() == 0)
return;
QueueItem* previous = (QueueItem*) current->itemBelow();
if(previous == 0)
return;
else
{
int tmp = previous->getPriority();
if(tmp == 0)
return;
previous->setPriority(current->getPriority());
current->setPriority(tmp);
getCurrentList()->sort();
}
}