当前位置: 首页>>代码示例>>C++>>正文


C++ QVariantList::contains方法代码示例

本文整理汇总了C++中QVariantList::contains方法的典型用法代码示例。如果您正苦于以下问题:C++ QVariantList::contains方法的具体用法?C++ QVariantList::contains怎么用?C++ QVariantList::contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QVariantList的用法示例。


在下文中一共展示了QVariantList::contains方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: paint

void RuleDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
  QStyleOptionViewItemV4 o = option;


  o.text = index.model()->data(index, Qt::DisplayRole).toString();
  o.displayAlignment = Qt::AlignCenter;
  int column = index.model()->headerData(index.column(),Qt::Horizontal,bfmodel::IdRole).toInt();

//  if (index.column() < 6) o.state = QStyle::State_ReadOnly;
   QVariantList l = index.model()->data(index, bfmodel::DirtyRole).toList();

   if (l.contains(column))
      o.font.setBold(true);

  int value = index.model()->data(index, Qt::DisplayRole).toInt();

  switch(column)
  {
      case bfmodel::SRCIP:     if(value ==0) o.text = "ALL"; else o.text = QHostAddress(static_cast<quint32>(value)).toString(); break;
      case bfmodel::SRCPORT:   if(value ==0) o.text = "ALL"; break;
      case bfmodel::DSTIP:     if(value ==0) o.text = "ALL"; else o.text = QHostAddress(static_cast<quint32>(value)).toString(); break;
      case bfmodel::DSTPORT:   if(value ==0) o.text = "ALL"; break;
      case bfmodel::PROTO:     o.text = get_proto_name(value); break;
      case bfmodel::CHAIN:     o.text = get_chain_name(static_cast<bf_chain_t>(value));  break;
      case bfmodel::POLICY:    o.text = get_policy_name(static_cast<bf_policy_t>(value));   break;
      case bfmodel::OFF:       o.text = get_sw_name(static_cast<bf_switch_rules_t>(value));  break;
  }


  QApplication::style()->drawControl(QStyle::CE_ItemViewItem, &o, painter);
}
开发者ID:tailored,项目名称:bf,代码行数:32,代码来源:ruledelegate.cpp

示例2: setEditorData

void CReportDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
    const QAbstractItemModel* model = index.model();
    QVariant data = index.data(Qt::DisplayRole);
    //Populate the editor
    if(data.type() != QVariant::List)
        QStyledItemDelegate::setEditorData(editor,index);

    QVariantList validReports = index.data(Qt::EditRole).toList();
    QVariantList currentReportsList = data.toList();

    QListWidget* listWidget = static_cast<QListWidget*>(editor);
    // Prepare the items in the list
    foreach(QVariant dataElement,validReports)
    {
        QString outString = dataElement.toString();
        if(m_reportNameModel!=(QAbstractItemModel*)NULL)
        {
            outString+=":"+searchReportColumnForId(dataElement.toInt());
        }
        QListWidgetItem* item = new QListWidgetItem(outString);
        item->setData(Qt::UserRole,dataElement);
        //Now, determine if the ítem SHOULD be checked
        if(currentReportsList.contains(dataElement))
        {
            item->setCheckState(Qt::Checked);

        }
        else
        {
            item->setCheckState(Qt::Unchecked);
        }

        listWidget->addItem(item);
    }
开发者ID:INSYEN,项目名称:DTNOTronAdminGUI,代码行数:35,代码来源:creportdelegate.cpp

示例3: hash

bool
TestBindata::cbRemove2 (QVariantList list)
{
	QVariant hash (m_serverhash);

	TVERIFY (!list.contains (hash), "Server still contains Bindata");

	waitDone ();
	return true;
}
开发者ID:caotic,项目名称:libxmms2qt,代码行数:10,代码来源:test_bindata.cpp

示例4: PendingEntityIDs

/// @remark Enables a 'pending' logic in SyncManager, with which a script can throttle the sending of entities to clients.
QVariantList SceneSyncState::PendingEntityIDs() const
{
    QVariantList list;
    for(PendingConstIter iter = pendingEntities_.begin(); iter != pendingEntities_.end(); ++iter)
    {
        entity_id_t id = (*iter);
        if (!list.contains(id))
            list << id;
    }
    return list;
}
开发者ID:Fiware,项目名称:webui.Synchronization.Tundra,代码行数:12,代码来源:SyncState.cpp

示例5: selection

void tst_TimelineNotesModel::selection()
{
    TestNotesModel notes;
    TestModel model;
    notes.addTimelineModel(&model);
    int id1 = notes.add(10, 0, QLatin1String("blablub"));
    int id2 = notes.add(10, 0, QLatin1String("xyz"));
    QVariantList ids = notes.byTimelineModel(10);
    QCOMPARE(ids.length(), 2);
    QVERIFY(ids.contains(id1));
    QVERIFY(ids.contains(id2));

    ids = notes.byTypeId(7);
    QCOMPARE(ids.length(), 2);
    QVERIFY(ids.contains(id1));
    QVERIFY(ids.contains(id2));

    int got = notes.get(10, 0);
    QVERIFY(got == id1 || got == id2);
    QCOMPARE(notes.get(10, 20), -1);
    QCOMPARE(notes.get(20, 10), -1);
}
开发者ID:UIKit0,项目名称:qt-creator,代码行数:22,代码来源:tst_timelinenotesmodel.cpp

示例6: availableSizes

QVariantList Capture::availableSizes(const QString &webcam) const
{
    MediaTypesList mediaTypes = this->listMediaTypes(webcam);

    if (mediaTypes.isEmpty())
        return QVariantList();

    QVariantList resolutions;

    foreach (MediaTypePtr mediaType, mediaTypes) {
        VIDEOINFOHEADER *pInfoHeader = (VIDEOINFOHEADER *) mediaType->pbFormat;

        QSize size(pInfoHeader->bmiHeader.biWidth,
                   pInfoHeader->bmiHeader.biHeight);

        if (!resolutions.contains(size))
            resolutions << size;
    }
开发者ID:hpfn,项目名称:webcamoid,代码行数:18,代码来源:capture.cpp

示例7: XLet

ServicesPanel::ServicesPanel(QWidget * parent)
    : XLet(parent, tr("Services"), ":/images/tab-services.svg"),
      m_nofwd_sent(false)
{
    this->ui.setupUi(this);

    QVariantList features = b_engine->getConfig("services").toList();

    if (! features.contains("incallfilter")) {
        this->ui.call_filtering_checkbox->hide();
    }

    if (! features.contains("enablednd")) {
        this->ui.dnd_checkbox->hide();
    }

    if (! features.contains("fwdunc")) {
        this->ui.fwdunc_input->hide();
        this->ui.fwdunc_button->hide();
        this->ui.fwdunc_radiobutton->hide();
    }

    if (! features.contains("fwdrna")) {
        this->ui.fwdna_input->hide();
        this->ui.fwdna_button->hide();
        this->ui.fwdna_checkbox->hide();
    }

    if (! features.contains("fwdbusy")) {
        this->ui.fwdbusy_input->hide();
        this->ui.fwdbusy_button->hide();
        this->ui.fwdbusy_checkbox->hide();
    }

    if (! features.contains("fwdrna") && ! features.contains("fwdbusy")) {
        this->ui.fwdsimple_radiobutton->hide();
    }

    //hide search button inside input
    this->ui.fwdna_button->hide();
    this->ui.fwdbusy_button->hide();
    this->ui.fwdunc_button->hide();

    connect(b_engine, SIGNAL(updateUserConfig(const QString &, const QVariantMap &)),
            this, SLOT(updateUserConfig(const QString &, const QVariantMap &)));
}
开发者ID:namjae,项目名称:xivo-client-qt,代码行数:46,代码来源:servicespanel.cpp

示例8: checkBoxTag

/*!
  Creates a input tag with type="checkbox", name=\a "name" and value=\a "value".
  If the \a checkedValues parameter contains the \a value parameter, this checkbox is checked.
*/
QString TViewHelper::checkBoxTag(const QString &name, const QVariant &value, const QVariantList &checkedValues, const THtmlAttribute &attributes) const
{
    return checkBoxTag(name, value, (!value.toString().isEmpty() && checkedValues.contains(value)), attributes);
}
开发者ID:foundations,项目名称:treefrog-framework,代码行数:8,代码来源:tviewhelper.cpp

示例9: copyFiles

bool LibArchiveInterface::copyFiles(const QVariantList& files, const QString& destinationDirectory, ExtractionOptions options)
{
    kDebug() << "Changing current directory to " << destinationDirectory;
    QDir::setCurrent(destinationDirectory);

    const bool extractAll = files.isEmpty();
    const bool preservePaths = options.value(QLatin1String( "PreservePaths" )).toBool();

    QString rootNode = options.value(QLatin1String("RootNode"), QVariant()).toString();
    if ((!rootNode.isEmpty()) && (!rootNode.endsWith(QLatin1Char('/')))) {
        rootNode.append(QLatin1Char('/'));
    }

    ArchiveRead arch(archive_read_new());

    if (!(arch.data())) {
        return false;
    }

    if (archive_read_support_compression_all(arch.data()) != ARCHIVE_OK) {
        return false;
    }

    if (archive_read_support_format_all(arch.data()) != ARCHIVE_OK) {
        return false;
    }

    if (archive_read_open_filename(arch.data(), QFile::encodeName(filename()), 10240) != ARCHIVE_OK) {
        emit error(i18nc("@info", "Could not open the archive <filename>%1</filename>, libarchive cannot handle it.",
                   filename()));
        return false;
    }

    ArchiveWrite writer(archive_write_disk_new());
    if (!(writer.data())) {
        return false;
    }

    archive_write_disk_set_options(writer.data(), extractionFlags());

    int entryNr = 0;
    int totalCount = 0;

    if (extractAll) {
        if (!m_cachedArchiveEntryCount) {
            emit progress(0);
            //TODO: once information progress has been implemented, send
            //feedback here that the archive is being read
            kDebug() << "For getting progress information, the archive will be listed once";
            m_emitNoEntries = true;
            list();
            m_emitNoEntries = false;
        }
        totalCount = m_cachedArchiveEntryCount;
    } else {
        totalCount = files.size();
    }

    m_currentExtractedFilesSize = 0;

    bool overwriteAll = false; // Whether to overwrite all files
    bool skipAll = false; // Whether to skip all files
    struct archive_entry *entry;

    QString fileBeingRenamed;

    while (archive_read_next_header(arch.data(), &entry) == ARCHIVE_OK) {
        fileBeingRenamed.clear();

        // retry with renamed entry, fire an overwrite query again
        // if the new entry also exists
    retry:
        const bool entryIsDir = S_ISDIR(archive_entry_mode(entry));

        //we skip directories if not preserving paths
        if (!preservePaths && entryIsDir) {
            archive_read_data_skip(arch.data());
            continue;
        }

        //entryName is the name inside the archive, full path
        QString entryName = QDir::fromNativeSeparators(QFile::decodeName(archive_entry_pathname(entry)));

        if (entryName.startsWith(QLatin1Char( '/' ))) {
            //for now we just can't handle absolute filenames in a tar archive.
            //TODO: find out what to do here!!
            emit error(i18n("This archive contains archive entries with absolute paths, which are not yet supported by ark."));

            return false;
        }

        if (files.contains(entryName) || entryName == fileBeingRenamed || extractAll) {
            // entryFI is the fileinfo pointing to where the file will be
            // written from the archive
            QFileInfo entryFI(entryName);
            //kDebug() << "setting path to " << archive_entry_pathname( entry );

            const QString fileWithoutPath(entryFI.fileName());

            //if we DON'T preserve paths, we cut the path and set the entryFI
//.........这里部分代码省略.........
开发者ID:pombreda,项目名称:git-anongit.kde.org-ark,代码行数:101,代码来源:libarchivehandler.cpp


注:本文中的QVariantList::contains方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。