本文整理汇总了C++中QTreeWidget::addTopLevelItem方法的典型用法代码示例。如果您正苦于以下问题:C++ QTreeWidget::addTopLevelItem方法的具体用法?C++ QTreeWidget::addTopLevelItem怎么用?C++ QTreeWidget::addTopLevelItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTreeWidget
的用法示例。
在下文中一共展示了QTreeWidget::addTopLevelItem方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadProjects
void EditTache::loadProjects()
{
ProjetManager& manager = ProjetManager::Instance();
unsigned int nbProj = manager.getNb();
QTreeWidget * tree = ui->treeWidget;
for(int i = 0; i < nbProj; i++)
{
QTreeWidgetItem * projet = new QTreeWidgetItem();
Projet& proj = manager.getProjet(i);
unsigned int nbTaches = proj.getNb();
projet->setText(0, QString::fromStdString(proj.getTitre()));
for(int i=0; i < nbTaches; i++)
{
QTreeWidgetItem * tache = new QTreeWidgetItem();
Tache& t = proj.getTache(i);
tache->setText(0, QString::fromStdString(t.getTitre()));
projet->addChild(tache);
}
tree->addTopLevelItem(projet);
}
}
示例2: CreateStructureWidget
QWidget* CarManagePage::CreateStructureWidget()
{
QGroupBox* structureWidget = new QGroupBox();
QHBoxLayout* hBox = new QHBoxLayout();
QToolButton* add = new QToolButton();
add->setText("+");
QToolButton* remove = new QToolButton();
remove->setText( "-" );
hBox->addWidget( add );
hBox->addWidget( remove );
hBox->addStretch( 1 );
QTreeWidget* tree = new QTreeWidget();
tree->setColumnCount( 1 );
QTreeWidgetItem* root = new QTreeWidgetItem( QStringList( tr( "DaQing GPS Center") ) );
QTreeWidgetItem* child1 = new QTreeWidgetItem( QStringList( tr( "test1" ) ) );
QTreeWidgetItem* child2 = new QTreeWidgetItem( QStringList( tr( "test2" ) ) );
root->addChild( child1 );
root->addChild( child2 );
root->setCheckState( 0, Qt::Unchecked );
child1->setCheckState( 0, Qt::Unchecked );
child2->setCheckState( 0, Qt::Unchecked );
tree->addTopLevelItem( root );
tree->expandAll();
QVBoxLayout* vBox = new QVBoxLayout();
vBox->addLayout( hBox );
vBox->addWidget( tree );
structureWidget->setLayout( vBox );
return structureWidget;
}
示例3: addToTree
void StatsView::addToTree(std::vector<StatsContainer *>& stats, QTreeWidgetItem *parent) {
QTreeWidget *statsTree = this->findChild<QTreeWidget *>("statsTree");
for (int i=0; i<stats.size(); ++i) {
StatsContainer *stat = stats[i];
DataContainerTreeItem *boostNode;
if (parent != 0) {
boostNode = new DataContainerTreeItem(parent);
}
else {
boostNode = new DataContainerTreeItem();
statsTree->addTopLevelItem(boostNode);
}
std::string statText = stat->getArg(0);
boostNode->setData(statText);
if (nameMappings.find(statText) != nameMappings.end()) {
statText = nameMappings[statText] + " (" + statText + ")";
} else if (stat->getPrefixList().size() > 0 || stat->getSuffixList().size() > 0) {
if (stat->getPrefixList().size() > 0) {
statText = stat->getPrefixList()[0] + " (" + statText + ")";
} else if (stat->getSuffixList().size() > 0) {
statText = stat->getSuffixList()[0] + " (" + statText + ")";
}
}
boostNode->setText(0, statText.c_str());
}
}
示例4: reloadGui
void PListEditorWidget::reloadGui(void )
{
QTreeWidget* tree = m_ui.plistTree;
tree->clear();
QTreeWidgetItem* rootNode = NULL;
if (m_currentPlist)
{
// Add information
if (m_currentPlist->GetType() == PLIST_ARRAY)
{
rootNode = generateArrayItem (m_currentPlist);
rootNode->setText (NameColumn, "Root");
}
else if (m_currentPlist->GetType() == PLIST_DICT)
{
rootNode = generateDictionaryItem (m_currentPlist);
rootNode->setText (NameColumn, "Root");
}
}
if (rootNode)
tree->addTopLevelItem(rootNode);
tree->expandAll();
for (int x=0; x < tree->columnCount(); ++x)
tree->resizeColumnToContents(x);
}
示例5: DataContainerTreeItem
DataContainerTreeItem *StatsView::addFolder(std::string folderName) {
QTreeWidget *statsTree = this->findChild<QTreeWidget *>("statsTree");
DataContainerTreeItem *item = new DataContainerTreeItem();
statsTree->addTopLevelItem(item);
item->setText(0, folderName.c_str());
return item;
}
示例6: Callback_FileList
void leyrat::Callback_FileList(const char *ip, char**files, int numfiles)
{
Log("[R][%s] Listed files!\n", ip);
//you could also create it dinamically
if(numfiles==1)
return;
QTreeWidget * tree = fbrowser->treeWidget;
while(tree->topLevelItemCount())
{
tree->takeTopLevelItem(0);
}
QTreeWidgetItem* header = tree->headerItem();
const QByteArray headerbytes = header->text(0).toLatin1();
if(strcmp(files[0], "C:/*.*")!=0)
{
QTreeWidgetItem * item = new QTreeWidgetItem();
item->setText(0, "..");
tree->addTopLevelItem(item);
}
for(int i=1; i<numfiles; i++)
{
QTreeWidgetItem * item = new QTreeWidgetItem();
if(!strcmp(files[i], "..")||!strcmp(files[i], "."))
continue;
item->setText(0, files[i]);
tree->addTopLevelItem(item);
}
files[0][strlen(files[0])-3] = 0;
header->setText(0, files[0]);
}
示例7: KsweeperAdaptor
Sweeper::Sweeper(bool automatic)
: KXmlGuiWindow(0)
, m_privacyConfGroup(KSharedConfig::openConfig(QLatin1String( "kprivacyrc" ), KConfig::NoGlobals), "Cleaning")
, m_automatic(automatic)
{
QWidget *mainWidget = new QWidget(this);
ui.setupUi(mainWidget);
setCentralWidget(mainWidget);
QTreeWidget *sw = ui.privacyListView;
KStandardAction::quit(this, SLOT(close()), actionCollection());
createGUI(QLatin1String( "sweeperui.rc" ));
setAutoSaveSettings();
generalCLI = new QTreeWidgetItem(QStringList() << i18nc("General system content", "General"));
sw->addTopLevelItem(generalCLI);
webbrowsingCLI = new QTreeWidgetItem(QStringList() << i18nc("Web browsing content", "Web Browsing"));
sw->addTopLevelItem(webbrowsingCLI);
generalCLI->setExpanded(true);
webbrowsingCLI->setExpanded(true);
this->InitActions();
connect(ui.cleanupButton, SIGNAL(clicked()), SLOT(cleanup()));
connect(ui.selectAllButton, SIGNAL(clicked()), SLOT(selectAll()));
connect(ui.selectNoneButton, SIGNAL(clicked()), SLOT(selectNone()));
new KsweeperAdaptor(this);
QDBusConnection::sessionBus().registerObject(QLatin1String( "/ksweeper" ), this);
load();
if(automatic) {
cleanup();
close();
}
}
示例8: addIndividualDataItemToTree
void StatsView::addIndividualDataItemToTree(std::string dataName, QTreeWidgetItem *parent) {
QTreeWidget *statsTree = this->findChild<QTreeWidget *>("statsTree");
DataContainerTreeItem *dataNode;
if (parent != 0) {
dataNode = new DataContainerTreeItem(parent);
}
else {
dataNode = new DataContainerTreeItem();
statsTree->addTopLevelItem(dataNode);
}
dataNode->setData("");
dataNode->setText(0, dataName.c_str());
}
示例9: startElement
bool startElement(const QString&, const QString&, const QString& qName, const QXmlAttributes& attrs)
{
if (qName == "item")
{
//TODO : This will dump items if bookmarks get loaded into a different GUI language
if (quickHelpIndex->contains(attrs.value(1)))
{
bookmarkIndex->insert(attrs.value(0), qMakePair(attrs.value(1), attrs.value(2)));
view->addTopLevelItem(new QTreeWidgetItem(view, QStringList() << attrs.value(0)));
}
}
return true;
}
示例10: rebuildSceneGraph
void SceneDockWidget::rebuildSceneGraph()
{
SceneData* data = controller->getSceneData();
QTreeWidget* sceneGraph = ui->treeWidgetSceneGraph;
QTreeWidgetItem* top;
while((top = sceneGraph->takeTopLevelItem(0)) != 0);
QTreeWidgetItem* root = createNodeItem(data->rootNode);
sceneGraph->addTopLevelItem(root);
sceneGraph->expandAll();
}
示例11: MostrarArvoreSintatica
void MostrarArvoreSintatica(ArvoreSintatica *ar)
{
QStringList headers;
headers.append("Descricao");
headers.append("Nivel Lexico");
headers.append("Terminal");
QTreeWidget *tree = new QTreeWidget(0);
QTreeWidgetItem *item = new QTreeWidgetItem();
ar->toTree(item);
tree->setColumnCount(3);
tree->setHeaderLabels(headers);
tree->addTopLevelItem(item);
tree->show();
}
示例12: ItemType
typename ItemTypeMap<EntityContainer>::T* add_collection_item(
Scene& scene,
EntityContainer& entities,
ProjectBuilder& project_builder)
{
typedef typename ItemTypeMap<EntityContainer>::T ItemType;
ItemType* item =
new ItemType(
scene,
entities,
project_builder);
m_tree_widget->addTopLevelItem(item);
return item;
}
示例13: add_environment_item
EnvironmentItem* add_environment_item(
Scene& scene,
Environment* environment,
ProjectBuilder& project_builder)
{
EnvironmentItem* item =
new EnvironmentItem(
environment,
scene,
project_builder);
item->set_allow_deletion(false);
m_tree_widget->addTopLevelItem(item);
return item;
}
示例14: add_camera_item
CameraItem* add_camera_item(
Scene& scene,
Camera* camera,
ProjectBuilder& project_builder)
{
CameraItem* item =
new CameraItem(
camera,
scene,
project_builder);
item->set_allow_deletion(false);
m_tree_widget->addTopLevelItem(item);
return item;
}
示例15:
CollectionItem<Entity, Scene>* add_multi_model_collection_item(
Scene& scene,
EntityContainer& entities,
ProjectBuilder& project_builder)
{
CollectionItem<Entity, Scene>* item =
new MultiModelCollectionItem<Entity, Scene>(
new_guid(),
EntityTraits<Entity>::get_human_readable_collection_type_name(),
scene,
project_builder);
item->add_items(entities);
m_tree_widget->addTopLevelItem(item);
return item;
}