| 1705 | } |
| 1706 | |
| 1707 | void G4UIQt::UpdateSceneTree(const G4SceneTreeItem& root) |
| 1708 | { |
| 1709 | // G4debug << "\nG4UIQt::UpdateSceneTree: scene tree summary\n"; |
| 1710 | // root.DumpTree(G4debug); // Verbosity = 0 (one line per item) |
| 1711 | // G4debug << "\nG4UIQt::UpdateSceneTree: scene tree dump\n"; |
| 1712 | // root.DumpTree(G4debug,1); // Verbosity = 1 (higher levels available) |
| 1713 | |
| 1714 | // Clear the existing GUI-side tree |
| 1715 | fNewSceneTreeItemTreeWidget->clear(); |
| 1716 | // (I think this deletes everything - the top level items and their children.) |
| 1717 | fMaxPVDepth = 0; |
| 1718 | |
| 1719 | // Build a new GUI-side tree |
| 1720 | fNewSceneTreeItemTreeWidget->setHeaderLabel (root.GetDescription().c_str()); |
| 1721 | for (const auto& model : root.GetChildren()) { |
| 1722 | |
| 1723 | auto item = new QTreeWidgetItem(fNewSceneTreeItemTreeWidget); |
| 1724 | |
| 1725 | // Add this GUI-side representation of the model as a child of the top widget |
| 1726 | fNewSceneTreeItemTreeWidget->insertTopLevelItem(0,item); |
| 1727 | |
| 1728 | // Add text that appears in the scene tree |
| 1729 | item->setText(0, model.GetModelType().c_str()); |
| 1730 | |
| 1731 | // Load with info from model |
| 1732 | // There may be a way to add data as a QVariant, or a list of QVariants, |
| 1733 | // but let's try adding a G4SceneTreeItem pointer as a hex string. (There |
| 1734 | // does not seem to be a way of adding a pointer directly.) |
| 1735 | std::ostringstream oss; oss << std::hex << &model; |
| 1736 | auto data = QVariant(oss.str().c_str()); |
| 1737 | item->setData(0, Qt::UserRole, data); |
| 1738 | |
| 1739 | // Load a tooltip |
| 1740 | G4String toolTipMessage = model.GetModelDescription(); |
| 1741 | if (!model.GetFurtherInfo().empty()) { |
| 1742 | toolTipMessage += "\n " + model.GetFurtherInfo(); |
| 1743 | } |
| 1744 | item->setToolTip(0, toolTipMessage.c_str()); |
| 1745 | |
| 1746 | // Set the check state |
| 1747 | item->setCheckState |
| 1748 | (0, model.GetVisAttributes().IsVisible()? Qt::Checked: Qt::Unchecked); |
| 1749 | |
| 1750 | // Set the expand state |
| 1751 | item->setExpanded(model.IsExpanded()); |
| 1752 | |
| 1753 | if (model.GetType() == G4SceneTreeItem::pvmodel) { |
| 1754 | thisSceneTreePVDepth = -1; // First item is the model - touchables hang from it |
| 1755 | BuildPVQTree(model,item); |
| 1756 | } |
| 1757 | } |
| 1758 | } |
| 1759 | |
| 1760 | |
| 1761 | void G4UIQt::UpdateDrawingStyle(G4int style) { |
no test coverage detected