本文整理汇总了C++中ListItem::setData方法的典型用法代码示例。如果您正苦于以下问题:C++ ListItem::setData方法的具体用法?C++ ListItem::setData怎么用?C++ ListItem::setData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListItem
的用法示例。
在下文中一共展示了ListItem::setData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rredraw
/*****************************************************************************
* Gets the needed information from the list and redraw
*****************************************************************************/
void ListGphScene::rredraw()
{
rclear();
//Input objects
ListItem* h1 = new ListItem();
h1->setAsTitle(true);
h1->setText("INPUTS");
h1->setPosY(currY);
h1->setData(32, QVariant(-1));
h1->setData(33, QVariant(-1));
currY += 17;
this->addItem(h1);
for (int i = 0; i < inputList.size(); i++)
{
GphListItem item = inputList[i];
ListItem* txt = new ListItem();
txt->setText(item.getText());
txt->setPosY(currY);
txt->setData(32, QVariant(item.getId()));
txt->setData(33, QVariant(item.getType()));
this->addItem(txt);
currY += 17;
}
//Output objects
ListItem* h2 = new ListItem();
h2->setAsTitle(true);
h2->setText("OUTPUTS");
h2->setPosY(currY);
h2->setData(32, QVariant(-1));
h2->setData(33, QVariant(-1));
currY += 17;
this->addItem(h2);
for (int i = 0; i < outputList.size(); i++)
{
GphListItem item = outputList[i];
ListItem* txt = new ListItem();
txt->setText(item.getText());
txt->setPosY(currY);
txt->setData(32, QVariant(item.getId()));
txt->setData(33, QVariant(item.getType()));
this->addItem(txt);
currY += 17;
}
//Filter objects
ListItem* h3 = new ListItem();
h3->setAsTitle(true);
h3->setText("FILTERS");
h3->setPos(0,currY);
h3->setData(32, QVariant(-1));
h3->setData(33, QVariant(-1));
currY += 17;
this->addItem(h3);
for (int i = 0; i < filterList.size(); i++)
{
GphListItem item = filterList[i];
ListItem* txt = new ListItem();
txt->setText(item.getText());
txt->setPosY(currY);
txt->setData(32, QVariant(item.getId()));
txt->setData(33, QVariant(item.getType()));
this->addItem(txt);
currY += 17;
}
}