本文整理汇总了C++中QListWidget::removeItemWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QListWidget::removeItemWidget方法的具体用法?C++ QListWidget::removeItemWidget怎么用?C++ QListWidget::removeItemWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListWidget
的用法示例。
在下文中一共展示了QListWidget::removeItemWidget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: onLabelRemoved
void MainWindow::onLabelRemoved(medusa::Label const & label)
{
QString labelName = QString::fromStdString(label.GetName());
QListWidget *curList = nullptr;
switch (label.GetType())
{
case medusa::Label::LabelData: curList = dataList; break;
case medusa::Label::LabelCode: curList = codeList; break;
case medusa::Label::LabelString: curList = stringList; break;
default: break;
}
if (curList != nullptr)
{
auto items = curList->findItems(labelName, Qt::MatchExactly);
// something bad happened
if (items.size() != 1) return;
auto item = items.takeFirst();
curList->removeItemWidget(item);
delete item;
}
if (label.GetType() & medusa::Label::LabelImported)
curList = importedList;
else if (label.GetType() & medusa::Label::LabelExported)
curList = exportedList;
if (curList != nullptr)
{
auto items = curList->findItems(labelName, Qt::MatchExactly);
// something bad happened
if (items.size() != 1) return;
auto item = items.takeFirst();
curList->removeItemWidget(item);
delete item;
}
}
示例2: EditItem
void OBSBasicFilters::EditItem(QListWidgetItem *item, bool async)
{
Qt::ItemFlags flags = item->flags();
OBSSource filter = item->data(Qt::UserRole).value<OBSSource>();
const char *name = obs_source_get_name(filter);
QListWidget *list = async ? ui->asyncFilters : ui->effectFilters;
item->setText(QT_UTF8(name));
item->setFlags(flags | Qt::ItemIsEditable);
list->removeItemWidget(item);
list->editItem(item);
item->setFlags(flags);
}
示例3: delUv
void PredicatXUVParmis::delUv()
{
QListWidget *candidat = sender()->parent()->findChild<QListWidget*>("candidat");
if(!candidat)
UTPROFILER_EXCEPTION("L'editeur de prédicat est corrompu");
QList<QListWidgetItem*> selection = candidat->selectedItems();
if(selection.isEmpty())
return;
for(auto it = selection.begin() ; it != selection.end() ; it++)
{
QListWidgetItem *item = *it;
qDebug() << item->text();
candidat->removeItemWidget(item);
candidats.removeOne(item->text()); //TODO changer le nom de tout ça
}
}