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


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

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


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

示例1: desktops_read_names

void MainDialog::desktops_read_names() {
  xmlNodePtr n;
  gint i;

  ui.desktop_names->clear();

  i = 0;
  n = tree_get_node("desktops/names", NULL)->children;

  while(n) {
    gchar* name;

    if(!xmlStrcmp(n->name, (const xmlChar*)"name")) {
      name = obt_xml_node_string(n);
      QString desktop_name = QString::fromUtf8(name);

      if(desktop_name.isEmpty())
        desktop_name = tr("(Unnamed desktop)");

      QListWidgetItem* item = new QListWidgetItem(desktop_name);
      item->setFlags(item->flags() | Qt::ItemIsEditable);
      ui.desktop_names->addItem(item);
      ++i;
    }

    n = n->next;
  }

  while(i < num_desktops) {
    QListWidgetItem* item = new QListWidgetItem(tr("(Unnamed desktop)"));
    item->setFlags(item->flags() | Qt::ItemIsEditable);
    ui.desktop_names->addItem(item);
    ++i;
  }
}
开发者ID:jeffreyhc,项目名称:obconf-qt,代码行数:35,代码来源:desktops.cpp

示例2: itemChanged

void CodeDependenciesDialog::itemChanged(QListWidgetItem* item)
{
	QString code0 = ui.codes->currentText();
	QString code1 = item->text();

	switch (item->checkState())
	{
	case Qt::Unchecked:
		graph->removeDependency(code0, code1);
		break;
	case Qt::PartiallyChecked:
		break;
	case Qt::Checked:
		graph->addDependency(code0, code1);
		break;
	}

#if 0
	disconnect(ui.dependsOn, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
	for (int i = 0; i < ui.dependsOn->count(); ++i)
	{
		QListWidgetItem* item = ui.dependsOn->item(i);
		QString code1 = item->text();

		if (graph->isDependencyValid(code0, code1) == true)
			item->setFlags(item->flags() | Qt::ItemIsEnabled);
		else
			item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
	}
	connect(ui.dependsOn, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(itemChanged(QListWidgetItem*)));
#endif

	updateCallOrder();
}
开发者ID:dev-life,项目名称:gideros,代码行数:34,代码来源:codedependenciesdialog.cpp

示例3: startElement

bool AnnotationConfigurationHandler::startElement( 
    const QString & /* namespaceURI */,
    const QString & /* localName */,
    const QString &qName,
    const QXmlAttributes &attributes )
{
  if ( !metAnnotationConfigurationTag && qName != "annotationConfiguration" )
  {
    errorStr = QObject::tr( "The file is not an Annotation Configuration file." );
    return false;
  }

  if ( qName == "annotationConfiguration" )
  {
    metAnnotationConfigurationTag = true;
  }
  else if ( qName == "entity" )
  {
    QListWidgetItem *item = new QListWidgetItem(listWidget);
    item->setFlags( item->flags() | Qt::ItemIsEditable );
    if (m_isEditor)
    {
      item->setFlags( item->flags() | Qt::ItemIsUserCheckable);
    }
    item->setText( attributes.value( "name" ) );
    QColor color( attributes.value( "color" ) );
    QColor white( Qt::white );
    QBrush brush( color );
    
    colors->push_back( QColor( attributes.value( "color" ).toLower() ) );
    (*colorNames2EntityTypes)[attributes.value( "color" ).toLower()] = attributes.value( "name" );
    /// @todo setBackgroundColor is deprecated in QT 4.2, replace by
    /// setBackground below after upgrading.
    /// item->setBackgroundColor  ( QColor( attributes.value( "color" ) ) );
    if (attributes.value("recursive") == "true")
    {
      m_recursiveEntityTypes->push_back(attributes.value( "name" ));
      QFont font = item->font();
      font.setItalic(true);
      font.setBold(true);
      item->setFont(font);
      if (m_isEditor)
      {
        item->setCheckState(Qt::Checked);
      }
    }
    else
    {
      if (m_isEditor)
      {
        item->setCheckState(Qt::Unchecked);
      }
    }
    item->setBackground  ( brush );
    item->setTextColor  ( white );
  }

  return true;
}
开发者ID:FaizaGara,项目名称:lima,代码行数:59,代码来源:annotationConfigurationHandler.cpp

示例4: createResources

void QtResourceViewPrivate::createResources(const QString &path)
{
    const bool matchAll = m_filterPattern.isEmpty();

    QDir dir(path);
    QStringList fileNames = m_pathToContents.value(path);
    QStringListIterator it(fileNames);
    while (it.hasNext()) {
        QString fileName = it.next();
        const bool showProperty = matchAll || fileName.contains(m_filterPattern, Qt::CaseInsensitive);
        if (showProperty) {
            QString filePath = dir.absoluteFilePath(fileName);
            QFileInfo fi(filePath);
            if (fi.isFile()) {
                QListWidgetItem *item = new QListWidgetItem(fi.fileName(), m_listWidget);
                const QPixmap pix = QPixmap(filePath);
                if (pix.isNull()) {
                    item->setToolTip(filePath);
                } else {
                    item->setIcon(QIcon(makeThumbnail(pix)));
                    const QSize size = pix.size();
                    item->setToolTip(QtResourceView::tr("Size: %1 x %2\n%3").arg(size.width()).arg(size.height()).arg(filePath));
                }
                item->setFlags(item->flags() | Qt::ItemIsDragEnabled);
                item->setData(Qt::UserRole, filePath);
                m_itemToResource[item] = filePath;
                m_resourceToItem[filePath] = item;
            }
        }
    }
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:31,代码来源:qtresourceview.cpp

示例5: 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

示例6: fillContentsFromTreeWidget

void TreeWidgetEditor::fillContentsFromTreeWidget(QTreeWidget *treeWidget)
{
    m_updating = true;
    copyContents(treeWidget, ui.treeWidget);

    ui.listWidget->clear();

    QTreeWidgetItem *headerItem = ui.treeWidget->headerItem();
    int colCount = ui.treeWidget->columnCount();
    for (int col = 0; col < colCount; col++) {
        QListWidgetItem *item = new QListWidgetItem(ui.listWidget);
        item->setFlags(item->flags() | Qt::ItemIsEditable);
        item->setText(headerItem->text(col));
        item->setIcon(headerItem->icon(col));
        item->setData(QAbstractFormBuilder::resourceRole(), headerItem->data(col, QAbstractFormBuilder::resourceRole()));
    }

    if (colCount > 0) {
        ui.listWidget->setCurrentRow(0);
        if (ui.treeWidget->topLevelItemCount() > 0)
            ui.treeWidget->setCurrentItem(ui.treeWidget->topLevelItem(0));
    }
    m_updating = false;
    updateEditor();
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:25,代码来源:treewidgeteditor.cpp

示例7: init

void PluginManager::init()
      {
      //
      // initialize local shortcut table
      //    we need a deep copy to be able to rewind all
      //    changes on "Abort"
      //
      qDeleteAll(localShortcuts);
      localShortcuts.clear();
      foreach(const Shortcut* s, Shortcut::shortcuts())
            localShortcuts[s->key()] = new Shortcut(*s);
      shortcutsChanged = false;

      preferences.updatePluginList();
      int n = preferences.pluginList.size();
      pluginList->clear();
      for (int i = 0; i < n; ++i) {
            PluginDescription& d = preferences.pluginList[i];
            Shortcut* s = &d.shortcut;
            localShortcuts[s->key()] = new Shortcut(*s);

            QListWidgetItem* item = new QListWidgetItem(QFileInfo(d.path).completeBaseName(),  pluginList);
            item->setFlags(item->flags() | Qt::ItemIsEnabled);
            item->setCheckState(d.load ? Qt::Checked : Qt::Unchecked);
            item->setData(Qt::UserRole, i);
            }
      prefs = preferences;
      if (n) {
            pluginList->setCurrentRow(0);
            pluginListItemChanged(pluginList->item(0), 0);
            }
      connect(pluginList, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(pluginLoadToggled(QListWidgetItem*)));
      connect(pluginList, SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)),
         SLOT(pluginListItemChanged(QListWidgetItem*, QListWidgetItem*)));
      }
开发者ID:Fyrult,项目名称:MuseScore,代码行数:35,代码来源:pluginManager.cpp

示例8: add

void ModelView::add() {

  QListWidgetItem* label = new QListWidgetItem ("New Author");

  label->setFlags(label->flags () | Qt::ItemIsEditable);
  ui->authorsList->addItem(label);
}
开发者ID:ufopleds,项目名称:DengueME,代码行数:7,代码来源:modelview.cpp

示例9: on_bt_add_clicked

void searchArtist::on_bt_add_clicked()
{
   //Verificar se existe algum artista já adicionado igual
    QList<QListWidgetItem*> items = ui->List_ALL->selectedItems();

    bool exist =false;
    int ID;
    QString Nome;

    for (int i = 0; i < items.count(); ++i)
    {
        exist = false;
        ID=items[i]->data(Qt::UserRole).toInt();
        Nome=items[i]->data(Qt::DisplayRole).toString();

        for (int j = 0; j < ui->List_NEW->count(); ++j)
        {
            if(ID == ui->List_NEW->item(j)->data(Qt::UserRole).toInt())
            {
                exist=true;
            }
        }

        if(!exist)
        {
            QListWidgetItem* item = new QListWidgetItem(Nome, ui->List_NEW);
            item->setData(Qt::UserRole,ID);
            item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
            item->setCheckState(Qt::Unchecked);
        }
    }
}
开发者ID:Grupo-9-EngenhariaSoftware2016,项目名称:Media-Player,代码行数:32,代码来源:searchartist.cpp

示例10: addItem

void AddRemoveListWidget::addItem(QString itemText) {
	QListWidgetItem *item = new QListWidgetItem();
	item->setFlags(item->flags() | Qt::ItemIsEditable);
	item->setText(itemText);
	m_list->addItem(item);
	m_list->editItem(item);
}
开发者ID:himanshuchoudhary,项目名称:cscope,代码行数:7,代码来源:addremovelistwidget.cpp

示例11: 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

示例12: addEntities

void PreserveEntitiesWidget::addEntities()
{
    QString list = QInputDialog::getText(this, tr("Add Entities"), tr("Entities:"));

    if (list.isEmpty()) {
        return;
    }

    list.replace(" ", ",");
    list.replace(",", "\n");
    QStringList names = list.split("\n");

    // Add the entities to the list
    foreach(QString name, names) {
        if (!name.isEmpty()) {
          if (XMLEntities::instance()->GetEntityCode(name) > 0) {
                QListWidgetItem *item = new QListWidgetItem(name, ui.entityList);
                item->setFlags(item->flags() | Qt::ItemIsEditable);
                ui.entityList->addItem(item);
            }
        }
    }
    ui.entityList->sortItems(Qt::AscendingOrder);

    m_isDirty = true;
}
开发者ID:Pedro1982,项目名称:Sigil,代码行数:26,代码来源:PreserveEntitiesWidget.cpp

示例13: 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

示例14: addPoseItem

void PoseEditor::addPoseItem(QString txt, Pose p) {
    QListWidgetItem* add = new QListWidgetItem();
    add->setText(txt);
    add->setFlags(add->flags() | Qt::ItemIsEditable);
    add->setData(Qt::UserRole, QVariant::fromValue(p));
    posesList->addItem(add);
}
开发者ID:mike08,项目名称:rcss3dMotionEditor_proto,代码行数:7,代码来源:poseeditor.cpp

示例15: doEventPlace

void HistoryElementModifyEvent::doEventPlace()
{
    if(!m_scene)
        return;

    LvlScene* lvlScene;
    if(!(lvlScene = qobject_cast<LvlScene*>(m_scene)))
        return;

    LevelSMBX64Event rmEvents = m_event;

    MainWinConnect::pMainWin->dock_LvlEvents->setEventToolsLocked(true);
    QListWidgetItem * item;
    item = new QListWidgetItem;
    item->setText(rmEvents.name);
    item->setFlags(Qt::ItemIsEditable);
    item->setFlags(item->flags() | Qt::ItemIsEnabled);
    item->setFlags(item->flags() | Qt::ItemIsEditable | Qt::ItemIsDragEnabled | Qt::ItemIsSelectable);
    item->setData(Qt::UserRole, QString::number(rmEvents.meta.array_id) );
    QListWidget* evList = MainWinConnect::pMainWin->dock_LvlEvents->getEventList();
    LevelSMBX64Event NewEvent = rmEvents;


    lvlScene->m_data->events.push_back(NewEvent);
    evList->addItem(item);

    lvlScene->m_data->meta.modified = true;

    MainWinConnect::pMainWin->EventListsSync();
    MainWinConnect::pMainWin->dock_LvlEvents->setEventToolsLocked(false);
}
开发者ID:Wohlhabend-Networks,项目名称:PGE-Project,代码行数:31,代码来源:historyelementmodifyevent.cpp


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