MCPcopy Create free account
hub / github.com/Geant4/geant4 / SceneTreeItemClicked

Method SceneTreeItemClicked

source/interfaces/implementation/src/G4UIQt.cc:1874–1925  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1872}
1873
1874void G4UIQt::SceneTreeItemClicked(QTreeWidgetItem* item)
1875{
1876 if (item == nullptr) return;
1877 auto sceneTreeItem = ConvertToG4SceneTreeItem(item);
1878 if (sceneTreeItem == nullptr) return;
1879
1880 auto uiMan = G4UImanager::GetUIpointer();
1881
1882 // Respond according to type
1883 G4String argument = "false", inverse = "true";
1884 auto newCheckState = item->checkState(0);
1885 auto oldCheckState
1886 = sceneTreeItem->GetVisAttributes().IsVisible()? Qt::Checked: Qt::Unchecked;
1887 switch (sceneTreeItem->GetType()) {
1888 case G4SceneTreeItem::unidentified:
1889 break; // Do nothing
1890 case G4SceneTreeItem::root:
1891 break; // Do nothing
1892 case G4SceneTreeItem::model:
1893 [[fallthrough]];
1894 case G4SceneTreeItem::pvmodel:
1895 // Clicked - but has checkbox actually been clicked?
1896 if (newCheckState != oldCheckState) {
1897 if (newCheckState == Qt::Checked) argument = "true";
1898 uiMan->ApplyCommand
1899 ("/vis/scene/activateModel \"" + sceneTreeItem->GetModelDescription() + "\" " + argument);
1900 }
1901 break;
1902 case G4SceneTreeItem::ghost:
1903 [[fallthrough]];
1904 case G4SceneTreeItem::touchable:
1905 // Construct and apply touchable commands
1906 // Clicked - but has checkbox actually been clicked?
1907 if (newCheckState != oldCheckState) {
1908 if (newCheckState == Qt::Checked) {
1909 argument = "true"; inverse = "false";
1910 }
1911 uiMan->ApplyCommand("/vis/set/touchable" + sceneTreeItem->GetPVPath());
1912 uiMan->ApplyCommand("/vis/touchable/set/visibility " + argument);
1913 static G4bool first = true;
1914 if (first && sceneTreeItem->GetChildren().size() > 0 && argument == "false") {
1915 QMessageBox msgBox;
1916 msgBox.setText
1917 ("To make all descendants invisible, select, then right-click/daughtersInvisible/true.");
1918 msgBox.setStandardButtons(QMessageBox::Ok);
1919 msgBox.exec();
1920 first = false;
1921 }
1922 }
1923 break;
1924 }
1925}
1926
1927void G4UIQt::SceneTreeItemDoubleClicked(QTreeWidgetItem* item)
1928{

Callers

nothing calls this directly

Calls 7

ConvertToG4SceneTreeItemFunction · 0.85
IsVisibleMethod · 0.80
GetChildrenMethod · 0.80
GetTypeMethod · 0.45
ApplyCommandMethod · 0.45
sizeMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected