本文整理汇总了C++中QStandardItem::removeRows方法的典型用法代码示例。如果您正苦于以下问题:C++ QStandardItem::removeRows方法的具体用法?C++ QStandardItem::removeRows怎么用?C++ QStandardItem::removeRows使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QStandardItem
的用法示例。
在下文中一共展示了QStandardItem::removeRows方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadModels
void AELoadedResourcesTreeView::LoadModels()
{
_modelResourcesItem->removeRows(0, _modelResourcesItem->rowCount());
Anima::AnimaModelsManager* mgr = _document->GetEngine()->GetScenesManager()->GetScene("AnimaEditor")->GetModelsManager();
for (int i = 0; i < mgr->GetModelsNumber(); i++)
{
Anima::AnimaModel* model = mgr->GetModel(i);
QStandardItem *resourceNameItem = new QStandardItem(QString("%0").arg(model->GetName()));
resourceNameItem->setData(QVariant::fromValue(model), ModelRole);
resourceNameItem->setEditable(true);
QStandardItem *resourceFileNameItem = new QStandardItem(QString("%0").arg(model->GetOriginFileName()));
resourceFileNameItem->setData(QVariant::fromValue(model), ModelRole);
resourceFileNameItem->setEditable(false);
QList<QStandardItem*> newItem;
newItem.append(resourceNameItem);
newItem.append(resourceFileNameItem);
resourceNameItem->removeRows(0, resourceNameItem->rowCount());
LoadModelMeshes(model, resourceNameItem);
LoadModelAnimations(model, resourceNameItem);
_modelResourcesItem->appendRow(newItem);
}
}
示例2: row
void
MSCalibrationForm::OnMSReferencesUpdated( const QModelIndex& index )
{
QStandardItemModel& model = *pModel_;
QStandardItem * item = model.itemFromIndex( index );
const adcontrols::MSReferences& refs = pMethod_->references();
if ( item->rowCount() )
item->removeRows( 0, item->rowCount() );
size_t row(0);
for ( adcontrols::MSReferences::vector_type::const_iterator it = refs.begin(); it != refs.end(); ++it, ++row ) {
int col = 0;
std::wstring formula = it->formula();
if ( ! it->adduct_or_loss().empty() )
formula += std::wstring( it->polarityPositive() ? L" + " : L" - ") + it->adduct_or_loss();
StandardItemHelper::appendRow( item, formula, true );
col++;
if ( item->columnCount() < col + 1 )
model.insertColumn( item->columnCount(), item->index() );
model.setData( model.index( row, col, index ), it->exactMass() );
col++;
if ( item->columnCount() < col + 1 )
model.insertColumn( item->columnCount(), item->index() );
model.setData( model.index( row, col, index ), it->enable() );
}
}
示例3: newStationsAvailable
void ShoutcastModel::newStationsAvailable(const QString & keyWord) {
QList<QStandardItem *> genreItemList = findItems(keyWord);
Q_ASSERT(genreItemList.count() == 1);
QStandardItem * genreItem = genreItemList[0];
genreItem->removeRows(0, genreItem->rowCount());
Q_ASSERT(genreItem->rowCount() == 0);
foreach(const ShoutcastStation & station, m_fetcher->stationsForKeyword(keyWord)) {
QStandardItem * bitRate = new LeadingIntSortedStandardItem(QString::number(station.bitRate()) + tr(" bps"));
QStandardItem * listeners = new LeadingIntSortedStandardItem(QString::number(station.listeners()));
QStandardItem * name = new QStandardItem(station.name());
name->setData(qVariantFromValue(station), StationRole);
genreItem->appendRow(QList<QStandardItem * >() << name << bitRate << listeners);
name->appendRow(new QStandardItem(tr("Please wait")));
}
}
示例4: updateFolder
void BookmarksContentsWidget::updateFolder(int folder)
{
QStandardItem *item = findFolder(folder);
if (!item)
{
return;
}
item->removeRows(0, item->rowCount());
const QList<BookmarkInformation*> bookmarks = BookmarksManager::getFolder(folder);
for (int i = 0; i < bookmarks.count(); ++i)
{
addBookmark(bookmarks.at(i), item);
}
}
示例5: populateEntries
void HistoryContentsWidget::populateEntries()
{
const QDate date = QDate::currentDate();
QList<QDate> dates;
dates << date << date.addDays(-1) << date.addDays(-7) << date.addDays(-14) << date.addDays(-30) << date.addDays(-365);
for (int i = 0; i < m_model->rowCount(); ++i)
{
m_ui->historyView->setRowHidden(i, m_model->invisibleRootItem()->index(), true);
QStandardItem *groupItem = m_model->item(i, 0);
if (groupItem)
{
groupItem->setData(dates.value(i, QDate()), Qt::UserRole);
groupItem->removeRows(0, groupItem->rowCount());
}
}
const QList<HistoryEntry> entries = HistoryManager::getEntries();
for (int i = 0; i < entries.count(); ++i)
{
addEntry(entries.at(i));
}
for (int i = 0; i < m_model->rowCount(); ++i)
{
QStandardItem *groupItem = m_model->item(i, 0);
if (groupItem)
{
groupItem->sortChildren(2, Qt::DescendingOrder);
}
}
m_isLoading = false;
emit loadingChanged(false);
}
示例6: entityBrowser_add
void Menu_Editor::entityBrowser_add(QString name, std::vector<int>* owners)
{
// Create / reuse row
QStandardItem* item = model_entityBrowser->item(num_rows);
// TRUE: Item doesn't exist, create new Item
if(item == 0)
{
item = new QStandardItem();
model_entityBrowser->setItem(num_rows, item);
}
num_rows++;
// Fill row with data
int num_entities = 0;
for(unsigned i=0; i<owners->size(); i++)
{
if(owners->at(i)!=0)
{
// Create data item
QStandardItem* data = new QStandardItem();
item->setChild(num_entities, 0, data);
model_entityBrowser->setData(data->index(), QVariant(owners->at(i)));
// Increment index
num_entities++;
}
}
// Remove unused rows
int excessRows = item->rowCount() - num_entities;
if(excessRows>0)
item->removeRows(num_entities, excessRows);
// Set name
item->setText("[" + QString::number(num_entities) + "] " + name);
}