Пример #1
0
void LandmarkBrowser::updateCategoryTable(const QList<QLandmarkCategory> &cats)
{
    QLandmarkCategory cat;
    QTableWidgetItem *item;
    for ( int i =0; i < cats.count(); ++i) {
        cat = cats.at(i);
        categoryTable->insertRow(categoryTable->rowCount());
        if(manager->isReadOnly(cat.categoryId())) {
            item = new QTableWidgetItem(cat.name() + "(global)");
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
            categoryTable->setItem(categoryTable->rowCount()-1,0, item);
        } else {
            item = new QTableWidgetItem(cat.name());
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);
            categoryTable->setItem(categoryTable->rowCount()-1,0,item);
        }

        item = new QTableWidgetItem(cat.categoryId().localId());
        item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        categoryTable->setItem(categoryTable->rowCount()-1,1, item);

        if (i %20)
            qApp->processEvents();
    }
}
/*!
    Convenience function that sets a single \a category to be removed.
    This function effectively calls setCategoryIds() with the ID of \a category.

    \sa setCategories(), setCategoryId()
*/
void QLandmarkCategoryRemoveRequest::setCategory(const QLandmarkCategory &category)
{
    Q_D(QLandmarkCategoryRemoveRequest);
    QMutexLocker ml(&d->mutex);
    d->categoryIds.clear();
    d->categoryIds.append(category.categoryId());
}
Пример #3
0
void LandmarkFilterDialog::showEvent(QShowEvent *showEvent)
{

    QList<QLandmarkCategory> categories = manager->categories();
    categoryComboBox->clear();

    for (int i=0; i < categories.count(); ++i) {
        QLandmarkCategory category = categories.at(i);
        QVariant var;
        var.setValue(category.categoryId());
        categoryComboBox->addItem(category.name(),var);

        if (oldCategoryId.isValid() && oldCategoryId == category.categoryId()) {
            categoryComboBox->setCurrentIndex(i);
        }
    }

    QDialog::showEvent(showEvent);
}
Пример #4
0
// Returns the stored under the given role for the item referred to by the index.
QVariant QDeclarativeLandmarkCategoryModel::data(const QModelIndex &index, int role) const
{
    QLandmarkCategory category = m_categories.value(index.row());

    switch (role) {
        case Qt::DisplayRole:
            return category.name();
        case CategoryRole:
            return QVariant::fromValue(m_categoryMap.value(category.categoryId().localId()));
    }
    return QVariant();
}