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


C++ QListWidgetItem::setCheckState方法代码示例

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


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

示例1: insertItem

 static void insertItem(QListWidget *list, const char *text, int hints)
 {
     QListWidgetItem *lwi = new QListWidgetItem(QLatin1String(text), list);
     lwi->setData(Qt::UserRole, hints);
     lwi->setFlags(lwi->flags() | Qt::ItemIsUserCheckable);
     lwi->setCheckState(Qt::Unchecked);
 }
开发者ID:agamez,项目名称:qt-x11-maemo,代码行数:7,代码来源:input.cpp

示例2: extractionCompleted

void SettingsDialog::extractionCompleted(const QString &filePath)
{
    QString docsetName;

    /// FIXME: Come up with a better approach
    for (const QString &key : m_tmpFiles.keys()) {
        if (m_tmpFiles[key]->fileName() == filePath) {
            docsetName = key;
            break;
        }
    }

    const QDir dataDir(m_application->settings()->docsetPath);
    const QString docsetPath = dataDir.absoluteFilePath(docsetName + QLatin1String(".docset"));

    // Write metadata about docset
    DocsetMetadata metadata = m_availableDocsets.contains(docsetName)
            ? m_availableDocsets[docsetName]
              : m_userFeeds[docsetName];
    metadata.save(docsetPath, metadata.latestVersion());

    m_docsetRegistry->addDocset(docsetPath);

    QListWidgetItem *listItem = findDocsetListItem(metadata.title());
    if (listItem) {
        listItem->setHidden(true);
        listItem->setCheckState(Qt::Unchecked);
        listItem->setData(ProgressItemDelegate::ShowProgressRole, false);
    }
    resetProgress();
    delete m_tmpFiles.take(docsetName);
}
开发者ID:FengJianjian,项目名称:zeal,代码行数:32,代码来源:settingsdialog.cpp

示例3: setUpGui

void LinkResourceDialog::setUpGui()
{
    QVBoxLayout* vbLayout = new QVBoxLayout(mainWidget());
    QLabel *resourceName = new QLabel(mainWidget());
    resourceName->setText(m_mainResource.genericLabel()+" : "+m_mainResource.className());
    m_resourceSearch = new KLineEdit(mainWidget());
    m_resourceSearch->setPlaceholderText(i18n("Search for resources"));
    vbLayout->addWidget(resourceName);
    vbLayout->addWidget(m_resourceSearch);
    connect(m_resourceSearch,SIGNAL(textChanged(QString)),this,SLOT(slotTriggerSearch(QString)));

    m_resourceList = new QListWidget(mainWidget());
    vbLayout->addWidget(m_resourceList);
    //m_resourceList->setViewMode(m_resourceList->IconMode);

    Q_FOREACH(Nepomuk::Resource resource, getLinkedResources()) {
        QListWidgetItem* item = new QListWidgetItem(resource.genericLabel(),m_resourceList);
        item->setCheckState(Qt::Checked);
        item->setToolTip(resource.uri());
        if(!resource.genericIcon().isEmpty()) {
            item->setIcon(KIcon(resource.genericIcon()));
        }
        else {
            item->setIcon(KIcon("nepomuk"));
        }
    }
开发者ID:gwpl,项目名称:resourcebrowser,代码行数:26,代码来源:linkresourcedialog.cpp

示例4: updateDocsets

void ZealSettingsDialog::updateDocsets()
{
    ui->downloadableGroup->show();
    QStringList docsetNames = docsets->names();
    bool missingMetadata = false;
    foreach(auto name, docsetNames){
        ZealDocsetMetadata metadata = docsets->meta(name);
        if(!metadata.isValid()){
            missingMetadata = true;
        }

        QString feedUrl = metadata.getFeedURL();
        if(!feedUrl.isEmpty()){
            auto reply = startDownload(feedUrl);

            QList<QListWidgetItem*> items = ui->docsetsList->findItems( QString(name), Qt::MatchFixedString);
            if(items.count() > 0){
                reply->setProperty("listItem", ui->docsetsList->row( items[0] ));
            } else {
                QListWidgetItem *item = new QListWidgetItem( name, ui->docsetsList );
                item->setCheckState( Qt::Checked );
                item->setHidden(true);
                ui->docsetsList->addItem( item );
                reply->setProperty("listItem", ui->docsetsList->row( item ));
            }

            reply->setProperty("metadata", QVariant::fromValue(metadata));
            connect(reply, SIGNAL(finished()), SLOT(extractDocset()));
        }
    }
开发者ID:GTmmiller,项目名称:zeal,代码行数:30,代码来源:zealsettingsdialog.cpp

示例5: getArtists

void searchArtist::getArtists(int song)
{
    qDebug() << "Musica a editar: " << song;
    _song = _songs[song];
    _newartists.clear();
    ui->List_ALL->clear();
    ui->List_NEW->clear();
    _song->getAutor(&_newartists);

    //Lista de Autores a adicionar e Remover

    for (int i = 0; i < _newartists.size(); ++i)
    {
        // Adicionar e remover items
        QListWidgetItem* item = new QListWidgetItem(_newartists[i]->getNome(), ui->List_NEW);
        item->setData(Qt::UserRole,_newartists[i]->getIdBD());
        item->setText(_newartists[i]->getNome());
        item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
        item->setCheckState(Qt::Unchecked);
    }

    for (int i = 0; i < _artists.size(); ++i)
    {
        QListWidgetItem* item = new QListWidgetItem(_artists[i]->getNome(), ui->List_ALL);
        item->setData(Qt::UserRole,_artists[i]->getIdBD()); //Associar ID do Artista
        item->setText(_artists[i]->getNome());
    }

}
开发者ID:Grupo-9-EngenhariaSoftware2016,项目名称:Media-Player,代码行数:29,代码来源:searchartist.cpp

示例6: createRuleItem

void AutomatedRssDownloader::createRuleItem(const RSS::AutoDownloadRule &rule)
{
    QListWidgetItem *item = new QListWidgetItem(rule.name(), m_ui->listRules);
    m_itemsByRuleName.insert(rule.name(), item);
    item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
    item->setCheckState(rule.isEnabled() ? Qt::Checked : Qt::Unchecked);
}
开发者ID:elFarto,项目名称:qBittorrent,代码行数:7,代码来源:automatedrssdownloader.cpp

示例7: Create

bool wxListBox::Create(wxWindow *parent, wxWindowID id,
            const wxPoint& pos,
            const wxSize& size,
            int n, const wxString choices[],
            long style,
            const wxValidator& validator,
            const wxString& name)
{
    Init();
    QListWidgetItem* item;
    m_qtWindow = m_qtListWidget = new wxQtListWidget( parent, this );

#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
#   pragma ivdep
#   pragma swp
#   pragma unroll
#   pragma prefetch
#   if 0
#       pragma simd noassert
#   endif
#endif /* VDM auto patch */
    while ( n-- > 0 )
    {
        item = new QListWidgetItem();
        item->setText(wxQtConvertString( *choices++ ));
        if ( m_hasCheckBoxes )
        {
            item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
            item->setCheckState(Qt::Unchecked);
        }
        m_qtListWidget->addItem(item);
    }
    return wxListBoxBase::Create( parent, id, pos, size, style, validator, name );
}
开发者ID:vdm113,项目名称:wxWidgets-ICC-patch,代码行数:34,代码来源:listbox.cpp

示例8: add

/*
 * Add highlighted entries into main data store
 */
void UploadImpl::add()
{
    // checked rather than selected seems more intuitive
    //	QList<QListWidgetItem *> items;
    //  items = listWidget->selectedItems();
	
    for (int n=0; n< listWidget->count(); ++n)
    {
        QListWidgetItem* i = listWidget->item(n);

        if ( (i->checkState() == Qt::Checked) &&
             (i->flags() & Qt::ItemIsEnabled) )
        {
            // userrole data contains location exercise list
            unsigned int pos = i->data(Qt::UserRole).toInt();

            //Disable once uploaded
            i->setFlags(0);
            i->setCheckState(Qt::Checked);
            
            // TODO add session ids to remove this date grouping hack.
            QDateTime initial(exdata[pos].date, exdata[pos].time);

            std::vector<ExerciseSet> sets;
            while (pos < exdata.size() &&
                   QDateTime(exdata[pos].date, exdata[pos].time) == initial)
            {
                sets.push_back(exdata[pos++]);
            }
            if (sets.size())
                ds->add(sets);
        }
    }
    close();
}
开发者ID:jerome-labidurie,项目名称:poolviewer,代码行数:38,代码来源:uploadimpl.cpp

示例9: QDialog

GraphExport::GraphExport(std::vector<GraphCurveInfo*> *curves, QWidget *parent) :
    QDialog(parent), ui(new Ui::GraphExport)
{
    ui->setupUi(this);
    ui->progress->hide();

    m_curves = curves;

    ui->colList->item(0)->setData(Qt::UserRole, -1);
    for(quint32 i = 0; i < curves->size(); ++i)
    {
        QString text = curves->at(i)->curve->title().text();
        ui->curveBox->addItem(text, QVariant(i));

        QListWidgetItem *item = new QListWidgetItem(ui->colList);
        item->setText(text);
        item->setData(Qt::UserRole, i);
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
        item->setCheckState(Qt::Checked);
    }

    connect(ui->colNamesBox, SIGNAL(clicked()),                     SLOT(updatePreview()));
    connect(ui->endBox,      SIGNAL(currentIndexChanged(int)),      SLOT(updatePreview()));
    connect(ui->sepEdit,     SIGNAL(textChanged(QString)),          SLOT(updatePreview()));
    connect(ui->colList,     SIGNAL(itemChanged(QListWidgetItem*)), SLOT(updatePreview()), Qt::QueuedConnection);

    updatePreview();
}
开发者ID:dimitarm1,项目名称:Lorris,代码行数:28,代码来源:graphexport.cpp

示例10: disableAllClicked

void Preferences::disableAllClicked()
{
  for (int i = 0; i < ui_.enabledFormatsList->count(); i++) {
    QListWidgetItem* item = ui_.enabledFormatsList->item(i);
    item->setCheckState(Qt::Unchecked);
  }
}
开发者ID:dkm,项目名称:gpsbabel-python-filter,代码行数:7,代码来源:preferences.cpp

示例11: QDialog

AddGroupToFlowDialog::AddGroupToFlowDialog(QWidget *parent) :
    QDialog(parent)
  , groupsListWidget(new QListWidget())
  , addButton(new QPushButton(QString("&Добавить")))
  , exitButton(new QPushButton(QString("&Отмена")))
{
    qDebug() << __FUNCTION__;
    setWindowTitle("Выбор групп");

    groupsListWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    QList<Group> groups = DbService::getInstance()->getAllGroups();

    for (auto group : groups)
    {
        QListWidgetItem* item = new QListWidgetItem(groupsListWidget);
        item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
        item->setCheckState(Qt::Unchecked);
        item->setText(group.getName());
        item->setData(Qt::UserRole, group.getId());
        groupsListWidget->addItem(item);
    }

    connect(addButton, SIGNAL(clicked()), this, SLOT(setSelectedIds()));
    connect(exitButton, SIGNAL(clicked()), this, SLOT(close()));

    QFormLayout *formLayout = new QFormLayout(this);
    formLayout->addRow(new QLabel(QString("Список групп:")));
    formLayout->addRow(groupsListWidget);
    formLayout->addRow(exitButton, addButton);
    setLayout(formLayout);
}
开发者ID:pavelalexeenko,项目名称:Ekon,代码行数:32,代码来源:add_group_to_flow_dialog.cpp

示例12: init

void AStylePreferences::init()
{
    // setup list widget to have checked items
    for(int i = 0; i < listIdentObjects->count(); i++) {
        QListWidgetItem *item = listIdentObjects->item(i);
        item->setFlags(Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
        item->setCheckState(Qt::Checked);
    }

    connect(tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(currentTabChanged()));

    connect(cbIndentType, SIGNAL(currentIndexChanged(int)), this, SLOT(indentChanged()));
    connect(inpNuberSpaces, SIGNAL(valueChanged(int)), this, SLOT(indentChanged()));
    connect(chkConvertTabs, SIGNAL(stateChanged(int)), this, SLOT(indentChanged()));
    connect(chkFillEmptyLines, SIGNAL(stateChanged(int)), this, SLOT(indentChanged()));

    connect(listIdentObjects, SIGNAL(itemChanged(QListWidgetItem*)),
             this, SLOT(indentObjectsChanged(QListWidgetItem*)));

    connect(inpMaxStatement, SIGNAL(valueChanged(int)), this, SLOT(minMaxValuesChanged()));
    connect(inpMinConditional, SIGNAL(valueChanged(int)), this, SLOT(minMaxValuesChanged()));

    connect(cbBrackets, SIGNAL(currentIndexChanged(int)), this, SLOT(bracketsChanged()));
    connect(chkBracketsCloseHeaders, SIGNAL(stateChanged(int)), this, SLOT(bracketsChanged()));

    connect(chkBlockBreak, SIGNAL(stateChanged(int)), this, SLOT(blocksChanged()));
    connect(chkBlockBreakAll, SIGNAL(stateChanged(int)), this, SLOT(blocksChanged()));
    connect(chkBlockIfElse, SIGNAL(stateChanged(int)), this, SLOT(blocksChanged()));

    connect(cbParenthesisPadding, SIGNAL(currentIndexChanged(int)), this, SLOT(paddingChanged()));
    connect(chkPadOperators, SIGNAL(stateChanged(int)), this, SLOT(paddingChanged()));

    connect(chkKeepStatements, SIGNAL(stateChanged(int)), this, SLOT(onelinersChanged()));
    connect(chkKeepBlocks, SIGNAL(stateChanged(int)), this, SLOT(onelinersChanged()));
}
开发者ID:portaloffreedom,项目名称:kdev-golang-plugin,代码行数:35,代码来源:astyle_preferences.cpp

示例13: dlg

/******************************************************************************
    addPlayer
******************************************************************************/
void
WizardSelectPluginPage::addPlayer()
{
    Q_ASSERT(mpPlayerVector != NULL);

    AddPlayerDialog dlg(*mpPlayerVector, this);
    if (dlg.exec() == QDialog::Accepted)
    {
        int nIdx = dlg.GetSelected();
        if (nIdx == -1)
        {
            return;
        }

        CPluginInfo& added = mpPlayerVector->at(nIdx);

        QString name = added.GetPlayerName();
        //name += " " + tr("(plugin not installed)");

        QListWidgetItem* item = new QListWidgetItem(name, ui.pluginList);
        item->setCheckState(Qt::Checked);

        // Store its position in players vector
        item->setData(1, nIdx);
    }

}
开发者ID:exic,项目名称:last.fm-dbus,代码行数:30,代码来源:wizardselectpluginpage.cpp

示例14: loadDuplicates

void RemoveDuplicates::loadDuplicates()
{
    Soprano::Model* model = Nepomuk::ResourceManager::instance()->mainModel();
    QString query
       = QString( "select distinct ?u1 where { "
                 "?r1 a %1 . ?r2 a %1. ?r1 %2 ?h. ?r2 %2 ?h. "
                 "?r1 %3 ?u1. ?r2 %3 ?u2. filter(?r1!=?r2) . }order by ?h limit 50")
         .arg( Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NFO::FileDataObject()))
         .arg( Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NFO::hasHash()))
         .arg( Soprano::Node::resourceToN3(Nepomuk::Vocabulary::NIE::url()));

    Soprano::QueryResultIterator it
       = model->executeQuery( query,
                              Soprano::Query::QueryLanguageSparql );
    Nepomuk::File tempRsc;
    while( it.next() ) {
        tempRsc = it.binding("u1").uri() ;
        QString usagecount = QString::number(tempRsc.usageCount());
        QListWidgetItem* item = new QListWidgetItem(tempRsc.genericLabel() + ":: Usage Count:" + usagecount,m_resourceList);
        item->setCheckState(Qt::Unchecked);
        item->setToolTip(tempRsc.url().path());
        qDebug()<<tempRsc.url().path();
    }

}
开发者ID:phalgun,项目名称:RepontiK,代码行数:25,代码来源:removeduplicates.cpp

示例15: foreach

  foreach( const MailCommon::Tag::Ptr &tag, tagList ) {
    if(tag->tagStatus)
      continue;
    QListWidgetItem *item = new QListWidgetItem(KIcon(tag->iconName), tag->tagName, mListTag );
    item->setData(UrlTag, tag->nepomukResourceUri.toString());
    item->setFlags( Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
    item->setCheckState( Qt::Unchecked );
    mListTag->addItem( item );

    if ( numberOfSelectedMessages == 1 ) {
      const bool hasTag = itemResource.tags().contains(  Nepomuk2::Tag( tag->tagName ) );
      item->setCheckState( hasTag ? Qt::Checked : Qt::Unchecked );
    } else {
      item->setCheckState( Qt::Unchecked );
    }    
  }
开发者ID:chusopr,项目名称:kdepim-ktimetracker-akonadi,代码行数:16,代码来源:tagselectdialog.cpp


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