本文整理汇总了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);
}
示例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);
}
示例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"));
}
}
示例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()));
}
}
示例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());
}
}
示例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);
}
示例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 );
}
示例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();
}
示例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();
}
示例10: disableAllClicked
void Preferences::disableAllClicked()
{
for (int i = 0; i < ui_.enabledFormatsList->count(); i++) {
QListWidgetItem* item = ui_.enabledFormatsList->item(i);
item->setCheckState(Qt::Unchecked);
}
}
示例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);
}
示例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()));
}
示例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);
}
}
示例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();
}
}
示例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 );
}
}