本文整理汇总了C++中TreeNode::copyHints方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeNode::copyHints方法的具体用法?C++ TreeNode::copyHints怎么用?C++ TreeNode::copyHints使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeNode
的用法示例。
在下文中一共展示了TreeNode::copyHints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
QtilitiesApplication a(argc, argv);
QtilitiesApplication::setOrganizationName("Jaco Naude");
QtilitiesApplication::setOrganizationDomain("Qtilities");
QtilitiesApplication::setApplicationName("Qtilities Tester");
QtilitiesApplication::setApplicationVersion(QtilitiesApplication::qtilitiesVersionString());
// Create the observer widget in tree mode:
ObserverWidget* observer_widget = new ObserverWidget;
observer_widget->resize(600,850);
QtilitiesApplication::setMainWindow(observer_widget);
Log->setLoggerSessionConfigPath(QtilitiesApplication::applicationSessionPath());
LOG_INITIALIZE();
TreeNode* rootNodeCategorized = new TreeNode("Root");
rootNodeCategorized->enableCategorizedDisplay();
// TODO: This breaks the toolbar for some reason... Looks like a display issue since it only happens in QTabWidget:
rootNodeCategorized->displayHints()->setDisplayFlagsHint(ObserverHints::ItemView | ObserverHints::ActionToolBar);
rootNodeCategorized->displayHints()->setActionHints(ObserverHints::ActionAllHints);
rootNodeCategorized->displayHints()->setCategoryEditingFlags(ObserverHints::CategoriesEditableAllLevels | ObserverHints::CategoriesAcceptSubjectDrops);
rootNodeCategorized->displayHints()->setDragDropHint(ObserverHints::AllowDrags);
rootNodeCategorized->addItem("Child 1",QtilitiesCategory("Category 1::A",QString("::")));
rootNodeCategorized->addItem("Child 2",QtilitiesCategory("Category 1::B",QString("::")));
rootNodeCategorized->addItem("Child 3");
rootNodeCategorized->addItem("Child 4",QtilitiesCategory("Category 2"));
TreeItem* modified_item = rootNodeCategorized->addItem("Child 5",QtilitiesCategory("Category 2"));
rootNodeCategorized->displayHints()->setModificationStateDisplayHint(ObserverHints::CharacterModificationStateDisplay);
modified_item->setModificationState(true);
// Init and show the observer widget:
observer_widget->setObserverContext(rootNodeCategorized);
observer_widget->initialize();
// Test the tree model:
new ModelTest(observer_widget->proxyModel());
// Test the table model:
//new ModelTest(observer_widget->tableModel());
observer_widget->show();
QStringList items;
items << "A" << "B" << "C";
rootNodeCategorized->addItems(items);
TreeNode* nodeA = rootNodeCategorized->addNode("Node A");
nodeA->copyHints(rootNodeCategorized->displayHints());
TreeNode* nodeB = rootNodeCategorized->addNode("Node B");
nodeB->copyHints(rootNodeCategorized->displayHints());
nodeA->addItem("Child 1",QtilitiesCategory("Category 3::A",QString("::")));
nodeA->addItem("Child 2",QtilitiesCategory("Category 4::B",QString("::")));
nodeA->addItem("Child 3");
nodeA->addItem("Child 4",QtilitiesCategory("Category 5"));
nodeB->addItem("Child 1",QtilitiesCategory("Category 6::A",QString("::")));
nodeB->addItem("Child 2",QtilitiesCategory("Category 7::B",QString("::")));
nodeB->addItem("Child 3");
nodeB->addItem("Child 4",QtilitiesCategory("Category 8"));
return a.exec();
}