Project

General

Profile

treeview unformat

Added by Juan Francisco González Navarro over 4 years ago

Hello, a beginner testing wt, trying in this case wt, I embbebed a treeview inside a dridlayout but is appearing fully unformat, Is anybody able to give me some clues?

hd = Wt::cpp14::make_uniqueWt::WTemplate(Wt::WString::tr("WTemplate-example2"));

contenedor = hd->bindWidget("arbol", Wt::cpp14::make_uniqueWt::WContainerWidget());

contenedor->setHeight(400);

layout = contenedor->setLayout(Wt::cpp14::make_uniqueWt::WGridLayout());

//Arbol

std::unique_ptrWt::WTree tree = Wt::cpp14::make_uniqueWt::WTree();

tree->setSelectionMode(Wt::SelectionMode::Extended);

auto folderIcon

= Wt::cpp14::make_uniqueWt::WIconPair("icons/yellow-folder-closed.png",

"icons/yellow-folder-open.png", false);

auto node =

Wt::cpp14::make_uniqueWt::WTreeNode("Furniture",std::move(folderIcon));

tree->setTreeRoot(std::move(node));

tree~~treeRoot()>label()->setTextFormat(Wt::TextFormat::Plain);

tree
treeRoot()>setLoadPolicy(Wt::ContentLoading::NextLevel);

tree
treeRoot()>addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Table"));

tree
treeRoot()~~>addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Cupboard"));

auto subtree = Wt::cpp14::make_uniqueWt::WTreeNode("Chair");

auto subtree_ = tree~~treeRoot()>addChildNode(std::move(subtree));

tree
treeRoot()>addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Coach"));

tree
treeRoot()~~>expand();

subtree_->addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Doc"));

subtree_->addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Grumpy"));

subtree_->addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Happy"));

subtree_->addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Sneezy"));

subtree_->addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Dopey"));

subtree_->addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Bashful"));

subtree_->addChildNode(Wt::cpp14::make_uniqueWt::WTreeNode("Sleepy"));

//Arbol

auto text2 = Wt::cpp14::make_uniqueWt::WText("contenido");

layout->addWidget(std::move(tree), 0, 0);

layout->addWidget(std::move(text2), 0, 1);

layout->setRowStretch(1, 1);

layout->setColumnStretch(1, 1);

layout->setColumnStretch(2, 1);

Thanks in advance