Ejemplo n.º 1
0
// private
void FilesWidget::applyFilter()
{
    QStandardItem *root = m_model.invisibleRootItem();
    int parentRowCount = root->rowCount();

    for (int parentRow = 0; parentRow < parentRowCount; ++parentRow) {
        QStandardItem *parent = root->child(parentRow);
        int childRowCount = parent->rowCount();
        bool hideParent = true;

        for (int childRow = 0; childRow < childRowCount; ++childRow) {
            QStandardItem *child = parent->child(childRow);
            bool hideChild = !filterAcceptsChild(child->index());

            if (!hideChild) {
                hideParent = false;
            }

            m_treeFiles->setRowHidden(childRow, parent->index(), hideChild);
        }

        updateParentItemMarkers(parent);

        m_treeFiles->setRowHidden(parentRow, root->index(), hideParent);
    }
}
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
// Returns a heading item with the given text. Will create and add a new heading under \c parentIndex at \c position if no heading with that text exists yet.  (Use -1 for \c position to append at the bottom.) If \c text is empty, will return the top-level (invisible root) item.
QStandardItem* AMWindowPaneModel::headingItem(const QString& text, QModelIndex parentIndex, int position) {
	if(text.isEmpty())
		return invisibleRootItem();

	QList<QStandardItem*> searchItems = this->findItems(text);
	foreach(QStandardItem* i, searchItems) {
		if(isHeading(i->index()))
			return i;
	}

	// Didn't find it... time to make it:
	QStandardItem* newHeading = new QStandardItem(text);
	newHeading->setFlags(Qt::ItemIsEnabled);	// enabled, but should not be selectable
	// graphics defaults:
	QFont font = QFont("Lucida Grande", 10, QFont::Bold);
	font.setCapitalization(QFont::AllUppercase);
	newHeading->setFont(font);
	newHeading->setData(QBrush(QColor::fromRgb(100, 109, 125)), Qt::ForegroundRole);

	QStandardItem* parent = itemFromIndex(parentIndex);
	if(parent) {
		if(position < 0 || position > parent->rowCount())
			position = parent->rowCount();
		parent->insertRow(position, newHeading);
	}
	else {
		if(position < 0 || position > rowCount())
			position = rowCount();
		insertRow(position, newHeading);
	}

	return newHeading;
}
Ejemplo n.º 4
0
void Window::updatePlayers(QStandardItem* planetItem, const QHash<QString, QList<StatisticsWebSite::PlayerInfo>>& playersHash)
{
    QHashIterator<QString, QList<StatisticsWebSite::PlayerInfo>> i(playersHash);

    for (int row = 0; row < planetItem->rowCount(); row ++) {
        bool found = false;
        QString address;

        i.toFront();
        while (i.hasNext()) {
            i.next();
            address = i.key();
            //4th column = ip:port = address
            if (planetItem->child(row, 4)->text() == address) {
                found = true;
                break;
            }
        }

        QStandardItem* gameItem = planetItem->child(row, 0);
        if (found) {
            if (gameItem->rowCount() != 0) {
                removeDisappearedPlayers(gameItem, playersHash[address]);
            }
            addAppearedPlayers(gameItem, playersHash[address]);
        } else {
            if (gameItem->rowCount() != 0) {
                removeAllPlayers(gameItem);
            }
        }
    }
}
Ejemplo n.º 5
0
bool ProgramsModel::AddProgram(int groupNum, QModelIndex &index, int row)
{
    QStandardItem *groupItem = item(groupNum);

    //if the group was disabled re-enable it
    if(groupItem->rowCount()==0) {
        groupItem->setBackground(Qt::transparent);
        groupItem->setToolTip("");
    }

    int progId = myHost->programsModel->GetNextProgId();

    QString name("New prog");

    //create the program item
    QStandardItem *prgItem = new QStandardItem( name );
    prgItem->setData(ProgramNode,NodeType);
    prgItem->setData(progId,ProgramId);
#ifndef QT_NO_DEBUG
    prgItem->setData(progId,Qt::ToolTipRole);
#endif
    prgItem->setDragEnabled(true);
    prgItem->setDropEnabled(false);
    prgItem->setEditable(true);

    if(row==-1)
        row=groupItem->rowCount();
    groupItem->insertRow(row, prgItem);

    index = prgItem->index();

//    ValidateProgChange(index);

    return true;
}
Ejemplo n.º 6
0
void Window::removeAllPlayers()
{
    for (int i = 0; i < planetTreeModel->rowCount(); i ++) {
        QStandardItem* planetItem = planetTreeModel->item(i, 0);
        for (int row = 0; row < planetItem->rowCount(); row ++) {
            QStandardItem* gameItem = planetItem->child(row, 0);
            if (gameItem->rowCount() != 0) {
                removeAllPlayers(gameItem);
            }
        }
    }
}
Ejemplo n.º 7
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.º 8
0
void RepoTreeModel::checkGroupRepo(const ServerRepo& repo)
{
    QStandardItem *root = invisibleRootItem();
    RepoCategoryItem *group = NULL;

    int row, n = root->rowCount();

    // First find for create the group
    // Starts from row 2 because the first two rows are "My Libraries" and "Shared Libraries"
    for (row = 2; row < n; row ++) {
        RepoCategoryItem *item = (RepoCategoryItem *)(root->child(row));
        if (item->groupId() == repo.group_id) {
            group = item;
            break;
        }
    }
    if (!group) {
        group = new RepoCategoryItem(repo.group_name, repo.group_id);
        appendRow(group);
    }

    // Find the repo in this group
    n = group->rowCount();
    for (row = 0; row < n; row++) {
        RepoItem *item = (RepoItem *)(group->child(row));
        if (item->repo().id == repo.id) {
            updateRepoItem(item, repo);
            return;
        }
    }

    // Current repo not in this group yet
    RepoItem *item = new RepoItem(repo);
    group->appendRow(item);
}
void NotifyOptionsWidget::apply()
{
	Options::node(OPV_NOTIFICATIONS_POPUPTIMEOUT).setValue(ui.spbPopupTimeout->value());

	for(QMap<QString, QStandardItem *>::const_iterator it=FTypeItems.constBegin(); it!=FTypeItems.constEnd(); ++it)
	{
		QStandardItem *typeNameItem = it.value();
		ushort kinds = !it.key().isEmpty() ? FNotifications->typeNotificationKinds(it.key()) : 0;
		for (int row=0; row<typeNameItem->rowCount(); row++)
		{
			QStandardItem *kindEnableItem = typeNameItem->child(row, COL_ENABLE);
			if (kindEnableItem->checkState() == Qt::Checked)
				kinds |= (ushort)kindEnableItem->data(MDR_KIND).toInt();
			else
				kinds &= ~((ushort)kindEnableItem->data(MDR_KIND).toInt());
		}

		if (!it.key().isEmpty())
			FNotifications->setTypeNotificationKinds(it.key(),kinds);
		else
			FNotifications->setEnabledNotificationKinds(kinds);
	}

	emit childApply();
}
Ejemplo n.º 10
0
// private slot
void FilesWidget::removeDocument(Document *document)
{
    Q_ASSERT(document != NULL);

    disconnect(document, &Document::modificationChanged, this, &FilesWidget::updateModificationMarkerOfSender);
    disconnect(document, &Document::locationChanged, this, &FilesWidget::updateLocationOfSender);

    QStandardItem *child = m_children.value(document, NULL);

    Q_ASSERT(child != NULL);
    Q_ASSERT(child != m_currentChild);

    QStandardItem *parent = child->parent();

    Q_ASSERT(parent != NULL);

    parent->removeRow(child->row());

    if (parent->rowCount() > 0) {
        updateParentItemMarkers(parent);
    } else {
        m_model.removeRow(parent->row());
    }

    m_children.remove(document);

    if (m_currentChild != NULL) {
        m_treeFiles->selectionModel()->select(m_currentChild->index(), QItemSelectionModel::ClearAndSelect);
    }
}
Ejemplo n.º 11
0
bool FilterModel::setData(const QModelIndex & index, 
        const QVariant& value, int role)
{
    bool res = QStandardItemModel::setData(index, value, role);

    if (role == Qt::CheckStateRole)
    {
        if (!index.parent().isValid())
        {
            QStandardItem * item = itemFromIndex(index);
            Qt::CheckState st = item->checkState(); 

            if (st != Qt::PartiallyChecked)
            {
                for (int i = 0; i < item->rowCount(); i++) 
                {
                    item->child(i)->setCheckState(st);
                }
            }
        }

        emit filterChanged();
    }

    return res;
}
Ejemplo n.º 12
0
void ClassifierTrainer::add_selection_to_positives_slot()
{
    QModelIndexList indices = positivesTreeView->selectionModel()->selectedIndexes();
    if (indices.length() > 0)
    {
        QModelIndex index = indices[0];
        QStandardItem *item = positivesModel->item(index.row());
        AddSectionDialog *dialog = new AddSectionDialog(item->text(), this);
        dialog->setModal(true);
        int response = dialog->exec();

        if (response == 1) // accepted
        {
            Section s = dialog->section();
            int sectionRowCount = item->rowCount() + 1;

            // save contents to project config file
            project->load();
            if (project->addSectionToPositiveImage(s))
            {
                project->save();

                // update ui
                updatePositivesGroup();
            }
        }
    }
}
Ejemplo n.º 13
0
void PreferencesDialog::saveWaveInfo()
{
    // Change focus to force save of any open editors..
    ui->waveSearch->setFocus();

    int toprows = waveModel->rowCount();

    bool ok;
    for (int i=0; i < toprows; i++) {
        QStandardItem * topitem = waveModel->item(i,0);

        if (!topitem) continue;
        int rows = topitem->rowCount();
        for (int j=0; j< rows; ++j) {
            QStandardItem * item = topitem->child(j, 0);
            if (!item) continue;

            ChannelID id = item->data(Qt::UserRole).toUInt(&ok);
            schema::Channel & chan = schema::channel[id];
            if (chan.isNull()) continue;
            chan.setEnabled(item->checkState() == Qt::Checked ? true : false);
            chan.setFullname(item->text());
            chan.setDefaultColor(QColor(topitem->child(j,1)->data(Qt::UserRole).toUInt()));
            chan.setShowInOverview(topitem->child(j,2)->checkState() == Qt::Checked);
            chan.setLowerThreshold(topitem->child(j,3)->text().toDouble());
            chan.setUpperThreshold(topitem->child(j,4)->text().toDouble());
            chan.setLabel(topitem->child(j,5)->text());
            chan.setDescription(topitem->child(j,6)->text());
        }
    }
}
 void resetModel()
 {
     q->clear();
     QFont bold;
     bold.setBold(true);
     // Create one item for each day of week
     for(int day = Qt::Monday; day <= Qt::Sunday; ++day) {
         QStandardItem *dayItem = new QStandardItem(QDate::longDayName(day));
         dayItem->setFont(bold);
         dayItem->setData(day, WeekDayRole);
         // Add availabilities to items
         const QVector<DayAvailability> &avail = m_UserCalendar->availabilities(day);
         for(int availabilityId = 0; availabilityId < avail.count(); ++availabilityId) {
             for(int timeRangeId = 0; timeRangeId < avail.at(availabilityId).timeRangeCount(); ++timeRangeId) {
                 TimeRange range = avail.at(availabilityId).timeRangeAt(timeRangeId);
                 QStandardItem *time = new QStandardItem(tkTr(Trans::Constants::FROM_1_TO_2).arg(range.from.toString()).arg(range.to.toString()));
                 time->setData(day, WeekDayRole);
                 time->setData(range.from, HourFromRole);
                 time->setData(range.to, HourToRole);
                 time->setData(timeRangeId, TimeRangeIdRole);
                 time->setData(availabilityId, AvailIdRole);
                 time->setToolTip(time->text());
                 dayItem->appendRow(time);
             }
         }
         if (dayItem->rowCount() > 0) {
             dayItem->sortChildren(0);
         }
         q->invisibleRootItem()->appendRow(dayItem);
     }
 }
Ejemplo n.º 15
0
bool BookmarksModel::save(const QString &path) const
{
	QSaveFile file(path);

	if (!file.open(QIODevice::WriteOnly))
	{
		return false;
	}

	QXmlStreamWriter writer(&file);
	writer.setAutoFormatting(true);
	writer.setAutoFormattingIndent(-1);
	writer.writeStartDocument();
	writer.writeDTD(QLatin1String("<!DOCTYPE xbel>"));
	writer.writeStartElement(QLatin1String("xbel"));
	writer.writeAttribute(QLatin1String("version"), QLatin1String("1.0"));

	QStandardItem *rootItem = item(0, 0);

	for (int i = 0; i < rootItem->rowCount(); ++i)
	{
		writeBookmark(&writer, rootItem->child(i, 0));
	}

	writer.writeEndDocument();

	return file.commit();
}
Ejemplo n.º 16
0
void QQInfoDlg::AddQQFriends(AccountInfo& accountInfo)
{
	int i = 0;

	for ( std::map<std::string, FriendInfo>::iterator it = accountInfo.friends.begin();
		it != accountInfo.friends.end();
		++it, ++i )
	{
		QStandardItem* item;

		if ( (*it).second.remark.empty() )
			item = new QStandardItem(Utils::utoq((*it).second.nickName + "(" + (*it).second.account + ")"));
		else
			item = new QStandardItem(Utils::utoq((*it).second.remark + "(" + (*it).second.account + ")"));

		if ( !(*it).second.signature.empty() )
			item->setData(Utils::utoq((*it).second.signature), Qt::ToolTipRole);

		if ( accountInfo.chatMap.find((*it).second.account) != accountInfo.chatMap.end() )
			item->setData(QBrush(QColor(255, 100, 100)), Qt::ForegroundRole);

		qDebug() << QString::fromUtf8((*it).second.groupName.c_str());

		item->setData(Utils::utoq((*it).second.account), Qt::UserRole);

		QStandardItem* group = FindParent((*it).second.groupName);

		group->setChild(group->rowCount(), item);
	}
}
Ejemplo n.º 17
0
void ResultsTree::ShowHiddenResults()
{
    //Clear the "hide" flag for each item
    int filecount = mModel.rowCount();
    for (int i = 0; i < filecount; i++) {
        QStandardItem *file = mModel.item(i, 0);
        if (!file)
            continue;

        QVariantMap data = file->data().toMap();
        data["hide"] = false;
        file->setData(QVariant(data));

        int errorcount = file->rowCount();
        for (int j = 0; j < errorcount; j++) {
            QStandardItem *child = file->child(j, 0);
            if (child) {
                data = child->data().toMap();
                data["hide"] = false;
                child->setData(QVariant(data));
            }
        }
    }
    RefreshTree();
    emit ResultsHidden(false);
}
Ejemplo n.º 18
0
void LayerManager::doPostRenderCallBack(bool yesno) {
    QStandardItem *root = _tree->invisibleRootItem();
    for (int layerIndex = 0; layerIndex < root->rowCount(); ++layerIndex) {
        LayerModel *lyr = static_cast<LayerModel *>(root->child(layerIndex));
        lyr->renderReady(yesno);
    }
}
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.º 20
0
void HistoryContentsWidget::removeDomainEntries()
{
	QStandardItem *domainItem = findEntry(getEntry(m_ui->historyView->currentIndex()));

	if (!domainItem)
	{
		return;
	}

	const QString host = QUrl(domainItem->text()).host();
	QList<qint64> entries;

	for (int i = 0; i < m_model->rowCount(); ++i)
	{
		QStandardItem *groupItem = m_model->item(i, 0);

		if (!groupItem)
		{
			continue;
		}

		for (int j = (groupItem->rowCount() - 1); j >= 0; --j)
		{
			QStandardItem *entryItem = groupItem->child(j, 0);

			if (entryItem && host == QUrl(entryItem->text()).host())
			{
				entries.append(entryItem->data(Qt::UserRole).toLongLong());
			}
		}
	}

	HistoryManager::removeEntries(entries);
}
Ejemplo n.º 21
0
//-----------------------------------------------------------------------------
void ctkActionsWidget::addAction(QAction* action, const QString& group)
{
  Q_D(ctkActionsWidget);
  QStandardItem* actionGroupItem = this->groupItem(group);
  Q_ASSERT(actionGroupItem);
  QList<QStandardItem*> actionItems;
  for (int i = 0; i < 4; ++i)
    {
    QStandardItem* item = new QStandardItem;
    item->setData(qVariantFromValue(qobject_cast<QObject*>(action)));
    item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    actionItems << item;
    }

  d->updateItems(actionItems, action);
  bool expandGroupItem = (actionGroupItem->rowCount() == 0);
  actionGroupItem->appendRow(actionItems);
  if (expandGroupItem)
    {
    qDebug() << d->ActionsModel->indexFromItem(actionGroupItem);
    d->ActionsTreeView->expand(
      d->SortFilterActionsProxyModel->mapFromSource(d->ActionsModel->indexFromItem(actionGroupItem)));
    }
  d->ActionsTreeView->resizeColumnToContents(0);
  connect(action, SIGNAL(changed()), this, SLOT(updateAction()));
}
Ejemplo n.º 22
0
void tst_QStandardItem::takeChild()
{
    QList<QStandardItem*> itemList;
    for (int i = 0; i < 10; ++i)
        itemList.append(new QStandardItem);
    QStandardItem item;
    item.appendColumn(itemList);

    for (int i = 0; i < item.rowCount(); ++i) {
        QCOMPARE(item.takeChild(i), itemList.at(i));
        QCOMPARE(item.takeChild(0, 0), static_cast<QStandardItem*>(0));
        for (int j = i + 1; j < item.rowCount(); ++j)
            QCOMPARE(item.child(j), itemList.at(j));
    }
    qDeleteAll(itemList);
}
Ejemplo n.º 23
0
void KoRecentDocumentsPane::updatePreview(const KFileItem& fileItem, const QPixmap& preview)
{
    if (preview.isNull()) {
        return;
    }

    QStandardItem* rootItem = model()->invisibleRootItem();

    for (int i = 0; i < rootItem->rowCount(); ++i) {
        KoFileListItem* item = static_cast<KoFileListItem*>(rootItem->child(i));
        if (item->fileItem().url() == fileItem.url()) {
            item->setData(preview, Qt::UserRole);
            QImage icon = preview.toImage();
            icon = icon.scaled(64, 64, Qt::KeepAspectRatio, Qt::SmoothTransformation);
            icon = icon.convertToFormat(QImage::Format_ARGB32);
            icon = icon.copy((icon.width() - 64) / 2, (icon.height() - 64) / 2, 64, 64);
            item->setData(QPixmap::fromImage(icon), Qt::DecorationRole);

            if (m_documentList->selectionModel()->currentIndex() == item->index()) {
                m_previewLabel->setPixmap(preview);
            }

            break;
        }
    }
}
void ConfigurationContentsWidget::optionChanged(const QString &option, const QVariant &value)
{
	for (int i = 0; i < m_model->rowCount(); ++i)
	{
		QStandardItem *groupItem = m_model->item(i, 0);

		if (!groupItem || !QString(option).startsWith(groupItem->text()))
		{
			continue;
		}

		for (int j = 0; j < groupItem->rowCount(); ++j)
		{
			QStandardItem *optionItem = groupItem->child(j, 0);

			if (optionItem && option == QStringLiteral("%1/%2").arg(groupItem->text()).arg(optionItem->text()))
			{
				QFont font = optionItem->font();
				font.setBold(value != SettingsManager::getDefaultValue(option));

				optionItem->setFont(font);

				groupItem->child(j, 2)->setText(value.toString());

				break;
			}
		}
	}
}
Ejemplo n.º 25
0
//-----------------------------------------------------------------------------
void ctkActionsWidget::addAction(QAction* action, const QString& group)
{
  Q_D(ctkActionsWidget);
  QStandardItem* actionGroupItem = this->groupItem(group);
  Q_ASSERT(actionGroupItem);
  QList<QStandardItem*> actionItems;
  for (int i = 0; i < 4; ++i)
    {
    QStandardItem* item = new QStandardItem;
    item->setData(qVariantFromValue(qobject_cast<QObject*>(action)));
    item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    actionItems << item;
    }

  d->updateItems(actionItems, action);
  
  bool expandGroupItem = (actionGroupItem->rowCount() == 0);
  actionGroupItem->appendRow(actionItems);
  // if the group didn't exist yet or was empty, then open/expand it
  // automatcally to show its contents. If the group was not empty, then let
  // it as is (maybe the user closed/collapsed it for a good reason...
  if (expandGroupItem)
    {
    d->ActionsTreeView->expand(
      d->SortFilterActionsProxyModel->mapFromSource(d->ActionsModel->indexFromItem(actionGroupItem)));
    }
  d->ActionsTreeView->resizeColumnToContents(0);
  connect(action, SIGNAL(changed()), this, SLOT(updateAction()));
}
Ejemplo n.º 26
0
void Hdd::configAccepted()
{
    KConfigGroup cg = config();
    KConfigGroup cgGlobal = globalConfig();
    QStandardItem *parentItem = m_hddModel.invisibleRootItem();

    clear();

    for (int i = 0; i < parentItem->rowCount(); ++i) {
        QStandardItem *item = parentItem->child(i, 0);
        if (item) {
            QStandardItem *child = parentItem->child(i, 1);
            if (child->text() != child->data().toString()) {
                cgGlobal.writeEntry(item->data().toString(), child->text());
            }
            if (item->checkState() == Qt::Checked) {
                appendSource(item->data().toString());
            }
        }
    }
    cg.writeEntry("uuids", sources());

    uint interval = ui.intervalSpinBox->value();
    cg.writeEntry("interval", interval);

    emit configNeedsSaving();
}
Ejemplo n.º 27
0
QPair<QtPropertyItem*, QtPropertyItem*> QtPropertyModel::GetProperty(const QString &name, QtPropertyItem* parent/* = NULL*/)
{
	QPair<QtPropertyItem*, QtPropertyItem*> ret(NULL, NULL);

    QStandardItem* root = (QStandardItem *) parent;
	if(NULL == root)
	{
		root = invisibleRootItem();
	}

    for(DAVA::int32 r = 0; r < root->rowCount(); ++r)
    {
        QtPropertyItem *keyItem = (QtPropertyItem *) root->child(r, 0);
        if(keyItem->GetPropertyData()->GetValue().toString() == name)
        {
            QtPropertyItem *dataItem = (QtPropertyItem *) root->child(r, 1);

			ret.first = keyItem;
			ret.second = dataItem;

			break;
        }
    }
    
    return ret;
}
Ejemplo n.º 28
0
QStandardItem* PlaylistListModel::FolderByPath(const QString& path) {
  if (path.isEmpty()) {
    return invisibleRootItem();
  }

  // Walk down from the root until we find the target folder.  This is pretty
  // inefficient but maintaining a path -> item map is difficult.
  QStandardItem* parent = invisibleRootItem();

  const QStringList parts = path.split('/', QString::SkipEmptyParts);
  for (const QString& part : parts) {
    QStandardItem* matching_child = nullptr;

    const int child_count = parent->rowCount();
    for (int i = 0; i < child_count; ++i) {
      if (parent->child(i)->data(Qt::DisplayRole).toString() == part) {
        matching_child = parent->child(i);
        break;
      }
    }

    // Does this folder exist already?
    if (matching_child) {
      parent = matching_child;
    } else {
      QStandardItem* child = NewFolder(part);
      parent->appendRow(child);
      parent = child;
    }
  }

  return parent;
}
Ejemplo n.º 29
0
void SaveChangesDialog::save()
{
    QStandardItem *rootItem = model->invisibleRootItem();
    for(int i=0; i<rootItem->rowCount(); ++i){
        QStandardItem *connectionItem = rootItem->child(i);
        for(int k=0; k<connectionItem->rowCount(); ++k){
            QStandardItem *tabItem = connectionItem->child(k);
            ConnectionPageTab *tab = (ConnectionPageTab*)tabItem->data().value<void*>();

            if(!tab->saveAll()){
                return;
            }
        }
    }

    accept();
}
Ejemplo n.º 30
0
bool LayerManager::doPostRenderCallBack() {
    bool renderReady = true;
    QStandardItem *root = _tree->invisibleRootItem();
    for (int layerIndex = 0; layerIndex < root->rowCount(); ++layerIndex) {
        LayerModel *lyr = static_cast<LayerModel *>(root->child(layerIndex));
        renderReady &= lyr->renderReady();
    }
    return renderReady;
}