本文整理汇总了C++中QTreeWidgetItem::setFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidgetItem::setFlags方法的具体用法?C++ QTreeWidgetItem::setFlags怎么用?C++ QTreeWidgetItem::setFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidgetItem
的用法示例。
在下文中一共展示了QTreeWidgetItem::setFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QTreeWidget
FunctionsTreeWidget::FunctionsTreeWidget(Doc *doc, QWidget *parent) :
QTreeWidget(parent)
, m_doc(doc)
{
sortItems(COL_NAME, Qt::AscendingOrder);
QTreeWidgetItem *root = invisibleRootItem();
root->setFlags(root->flags() & ~Qt::ItemIsDropEnabled);
connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
this, SLOT(slotItemChanged(QTreeWidgetItem*)));
}
示例2: addRootItem
// private
QTreeWidgetItem* QgsAuthSslConfigWidget::addRootItem( const QString &label )
{
QTreeWidgetItem *item = new QTreeWidgetItem(
QStringList() << label,
( int )ConfigParent );
setItemBold_( item );
item->setTextAlignment( 0, Qt::AlignVCenter );
item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
treeSslConfig->insertTopLevelItem( treeSslConfig->topLevelItemCount(), item );
return item;
}
示例3: AddDivider
void TrackSelectionDialog::AddDivider(const QString& text,
QTreeWidget* parent) const {
QTreeWidgetItem* item = new QTreeWidgetItem(parent);
item->setFirstColumnSpanned(true);
item->setText(0, text);
item->setFlags(Qt::NoItemFlags);
item->setForeground(0, palette().color(QPalette::Disabled, QPalette::Text));
QFont bold_font(font());
bold_font.setBold(true);
item->setFont(0, bold_font);
}
示例4: inseriRedePetri
void VisualizadorPropriedades::inseriRedePetri(QTreeWidgetItem *raiz, DRedePetri *redePetri)
{
QTreeWidgetItem *item = new QTreeWidgetItem;
item->setText(0, QString("Numero Lugares"));
item->setText(1, QString("%1").arg(redePetri->getNumeroLugar()));
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |Qt::ItemIsEnabled);
raiz->addChild(item);
item = new QTreeWidgetItem;
item->setText(0, QString("Numero Transicoes"));
item->setText(1, QString("%1").arg(redePetri->getNumeroTramsicao()));
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |Qt::ItemIsEnabled);
raiz->addChild(item);
item = new QTreeWidgetItem;
item->setText(0, QString("Numero Arcos"));
item->setText(1, QString("%1").arg(redePetri->getNumeroArco()));
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |Qt::ItemIsEnabled);
raiz->addChild(item);
}
示例5: GeometryStateDialog
ProfileDialog::ProfileDialog(QWidget *parent) :
GeometryStateDialog(parent),
pd_ui_(new Ui::ProfileDialog),
ok_button_(NULL)
{
GList *fl_entry;
profile_def *profile;
const gchar *profile_name = get_profile_name();
pd_ui_->setupUi(this);
loadGeometry();
setWindowTitle(wsApp->windowTitleString(tr("Configuration Profiles")));
ok_button_ = pd_ui_->buttonBox->button(QDialogButtonBox::Ok);
// XXX - Use NSImageNameAddTemplate and NSImageNameRemoveTemplate to set stock
// icons on macOS.
// Are there equivalent stock icons on Windows?
#ifdef Q_OS_MAC
pd_ui_->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
pd_ui_->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
pd_ui_->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);
pd_ui_->infoLabel->setAttribute(Qt::WA_MacSmallSize, true);
#endif
init_profile_list();
fl_entry = edited_profile_list();
pd_ui_->profileTreeWidget->blockSignals(true);
while (fl_entry && fl_entry->data) {
profile = (profile_def *) fl_entry->data;
QTreeWidgetItem *item = new QTreeWidgetItem(pd_ui_->profileTreeWidget);
item->setText(0, profile->name);
item->setData(0, Qt::UserRole, VariantPointer<GList>::asQVariant(fl_entry));
if (profile->is_global || profile->status == PROF_STAT_DEFAULT) {
QFont ti_font = item->font(0);
ti_font.setItalic(true);
item->setFont(0, ti_font);
} else {
item->setFlags(item->flags() | Qt::ItemIsEditable);
}
if (!profile->is_global && strcmp(profile_name, profile->name) == 0) {
pd_ui_->profileTreeWidget->setCurrentItem(item);
}
fl_entry = g_list_next(fl_entry);
}
pd_ui_->profileTreeWidget->blockSignals(false);
connect(pd_ui_->profileTreeWidget->itemDelegate(), SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
this, SLOT(editingFinished()));
updateWidgets();
}
示例6: QTreeWidgetItem
QTreeWidgetItem *SoundPage::addItem(QTreeWidgetItem *groupItem, const QString &name, const QString &event)
{
QTreeWidgetItem *item = new QTreeWidgetItem(TYPE_ITEM);
item->setData(COLUMN_DATA, ROLE_EVENT, event);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(COLUMN_NAME, soundManager->eventEnabled(event) ? Qt::Checked : Qt::Unchecked);
item->setText(COLUMN_NAME, name);
item->setText(COLUMN_FILENAME, soundManager->eventFilename(event));
groupItem->addChild(item);
return item;
}
示例7: fillInfo
void TocDock::fillInfo()
{
const QDomDocument *toc = document()->toc();
if (toc) {
fillToc(*toc, m_tree, 0);
} else {
QTreeWidgetItem *item = new QTreeWidgetItem();
item->setText(0, tr("No TOC"));
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
m_tree->addTopLevelItem(item);
}
}
示例8: addDEItem
void MainWindow::addDEItem(QString name, QString version)
{
QTreeWidgetItem* item = new QTreeWidgetItem(ui->DEList);
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
QFont font = item->font(0);
font.setBold(true);
item->setFont(0, font);
item->setText(0, name);
item->setText(1, version);
ui->DEList->addTopLevelItem(item);
}
示例9: onCastFolderAdded
void CastTreeViewer::onCastFolderAdded(const TFilePath &path) {
QTreeWidgetItem *root = topLevelItem(0)->child(0);
assert(root->data(1, Qt::DisplayRole).toString() ==
toQString(getLevelSet()->getDefaultFolder()));
QString childName = QString::fromStdWString(path.getWideName());
QString childPathQstr = QString::fromStdWString(path.getWideString());
QTreeWidgetItem *childItem =
new QTreeWidgetItem(root, QStringList(childName) << childPathQstr);
childItem->setFlags(childItem->flags() | Qt::ItemIsEditable);
root->addChild(childItem);
setCurrentItem(childItem);
}
示例10: parseFolderElement
void XbelTree::parseFolderElement(const QDomElement &element,
QTreeWidgetItem *parentItem)
{
QTreeWidgetItem *item = createItem(element, parentItem);
QString title = element.firstChildElement("title").text();
if (title.isEmpty())
title = QObject::tr("Folder");
item->setFlags(item->flags() | Qt::ItemIsEditable);
item->setIcon(0, folderIcon);
item->setText(0, title);
bool folded = (element.attribute("folded") != "no");
setItemExpanded(item, !folded);
QDomElement child = element.firstChildElement();
while (!child.isNull()) {
if (child.tagName() == "folder") {
parseFolderElement(child, item);
} else if (child.tagName() == "bookmark") {
QTreeWidgetItem *childItem = createItem(child, item);
QString title = child.firstChildElement("title").text();
if (title.isEmpty())
title = QObject::tr("Folder");
childItem->setFlags(item->flags() | Qt::ItemIsEditable);
childItem->setIcon(0, bookmarkIcon);
childItem->setText(0, title);
childItem->setText(1, child.attribute("href"));
} else if (child.tagName() == "separator") {
QTreeWidgetItem *childItem = createItem(child, item);
childItem->setFlags(item->flags() & ~(Qt::ItemIsSelectable | Qt::ItemIsEditable));
childItem->setText(0, QString(30, 0xB7));
}
child = child.nextSiblingElement();
}
}
示例11: QTreeWidgetItem
PLSelItem * PLSelector::addItem (
SelectorItemType type, const char* str, bool drop,
QTreeWidgetItem* parentItem )
{
QTreeWidgetItem *item = parentItem ?
new QTreeWidgetItem( parentItem ) : new QTreeWidgetItem( this );
PLSelItem *selItem = new PLSelItem( item, qtr( str ) );
setItemWidget( item, 0, selItem );
item->setData( 0, TYPE_ROLE, (int)type );
if( !drop ) item->setFlags( item->flags() & ~Qt::ItemIsDropEnabled );
return selItem;
}
示例12: showLocalInterfaces
void ManageInterfacesDialog::showLocalInterfaces()
{
guint i;
interface_t device;
gchar *pr_descr = g_strdup("");
char *comment = NULL;
ui->localList->clear();
for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
if (device.local && device.type != IF_PIPE && device.type != IF_STDIN) {
QTreeWidgetItem *item = new QTreeWidgetItem(ui->localList);
item->setFlags(item->flags() | Qt::ItemIsEditable);
if (prefs.capture_device && strstr(prefs.capture_device, device.name)) {
// Force the default device to be checked.
item->setFlags(item->flags() ^ Qt::ItemIsUserCheckable);
item->setCheckState(col_l_show_, Qt::Checked);
} else {
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(col_l_show_, device.hidden ? Qt::Unchecked : Qt::Checked);
}
#ifdef _WIN32
item->setText(col_l_friendly_name_, device.friendly_name);
#endif
item->setText(col_l_local_name_, device.name);
comment = capture_dev_user_descr_find(device.name);
if (comment) {
item->setText(col_l_comment_, comment);
g_free(comment);
} else if (device.if_info.vendor_description) {
item->setText(col_l_comment_, device.if_info.vendor_description);
}
} else {
continue;
}
}
g_free(pr_descr);
}
示例13: loadInstalled
void SettingsJavaPluginForm::loadInstalled()
{
for (QMap<QString,QString>::iterator it = m_installedPlugins.begin(); it != m_installedPlugins.end(); it++)
{
QString name = it.key();
name.remove(".jar");
QTreeWidgetItem* i = new QTreeWidgetItem(treeInstalled, QStringList() << name << it.value());
i->setFlags(i->flags() | Qt::ItemIsUserCheckable);
i->setCheckState(0, Qt::Unchecked);
treeInstalled->addTopLevelItem(i);
}
}
示例14: LoadSkel
void CDialogSkinAuto::LoadSkel()
{
const string skel = QFileDialog::getOpenFileName(this, tr("Charger un squelette"),
"Model/", tr("Fichier squelette (*.chr)"));
if (!skel.isEmpty())
{
QFileInfo fileInfo(skel);
ModelMng->SetModelPath(fileInfo.path() % '/');
CSkeleton* skl = ModelMng->GetSkeleton(fileInfo.fileName());
if (skl)
{
Delete(m_mesh->m_skeleton);
m_mesh->m_skeleton = skl;
DeleteArray(m_mesh->m_bones);
ui.bonesList->clear();
m_items.clear();
ui.skelName->setText(fileInfo.fileName());
m_mesh->m_bones = new D3DXMATRIX[skl->GetBoneCount() * 2];
m_mesh->m_invBones = m_mesh->m_bones + skl->GetBoneCount();
skl->ResetBones(m_mesh->m_bones, m_mesh->m_invBones);
QList<QTreeWidgetItem*> items;
QTreeWidgetItem* item;
Bone* bone;
for (int i = 0; i < skl->GetBoneCount(); i++)
{
bone = &skl->m_bones[i];
item = new QTreeWidgetItem(QStringList(bone->name));
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setCheckState(0, Qt::Unchecked);
item->setData(0, Qt::UserRole + 1, QVariant(i));
m_items[i] = item;
if (bone->parentID == -1)
items.append(item);
else
m_items[bone->parentID]->addChild(item);
}
ui.bonesList->insertTopLevelItems(0, items);
ui.bonesList->expandAll();
ui.okSkel->setEnabled(true);
}
}
}
示例15: parentItem
QTreeWidgetItem* FunctionsTreeWidget::parentItem(const Function* function)
{
Q_ASSERT(function != NULL);
// Special case for Sequences. They belong to a Scene node
if (function->type() == Function::Chaser && qobject_cast<const Chaser*>(function)->isSequence() == true)
{
quint32 sid = qobject_cast<const Chaser*>(function)->getBoundSceneID();
Function *sceneFunc = m_doc->function(sid);
if (sceneFunc != NULL)
{
QTreeWidgetItem *sceneTopItem = folderItem(sceneFunc->path());
if (sceneTopItem != NULL)
{
for (int i = 0; i < sceneTopItem->childCount(); i++)
{
QTreeWidgetItem *child = sceneTopItem->child(i);
Q_ASSERT(child != NULL);
if (sid == itemFunctionId(child))
return child;
}
}
}
}
QString basePath = Function::typeToString(function->type());
if (m_foldersMap.contains(QString(basePath + "/")) == false)
{
// Parent item for the given type doesn't exist yet so create one
QTreeWidgetItem* item = new QTreeWidgetItem(this);
item->setText(COL_NAME, basePath);
item->setIcon(COL_NAME, functionIcon(function));
item->setData(COL_NAME, Qt::UserRole, Function::invalidId());
item->setData(COL_NAME, Qt::UserRole + 1, function->type());
item->setText(COL_PATH, QString(basePath + "/"));
item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled);
m_foldersMap[QString(basePath + "/")] = item;
}
QTreeWidgetItem *pItem = folderItem(function->path());
if (pItem != NULL)
{
//qDebug() << "Found item for function:" << function->name() << ", path: " << function->path();
return pItem;
}
return NULL;
}