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);
	}
}
Ejemplo n.º 2
0
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() );
    }
}
Ejemplo n.º 3
0
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")));
	}
}
Ejemplo n.º 4
0
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);
	}
}
Ejemplo n.º 5
0
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);
}
Ejemplo n.º 6
0
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);
}