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

Method SceneTreeItemDoubleClicked

source/interfaces/implementation/src/G4UIQt.cc:1927–1957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1925}
1926
1927void G4UIQt::SceneTreeItemDoubleClicked(QTreeWidgetItem* item)
1928{
1929 if (item == nullptr) return;
1930 auto sceneTreeItem = ConvertToG4SceneTreeItem(item);
1931 if (sceneTreeItem == nullptr) return;
1932 if (sceneTreeItem->GetType() != G4SceneTreeItem::touchable) return;
1933
1934 auto oldQColor = ConvertG4ColourToQColor(sceneTreeItem->GetVisAttributes().GetColour());
1935 auto newQColor = QColorDialog::getColor
1936 (oldQColor, fNewSceneTreeItemTreeWidget, "", QColorDialog::ShowAlphaChannel);
1937 if (!newQColor.isValid()) return;
1938 if (newQColor == oldQColor) return;
1939
1940 auto newColour = ConvertQColorToG4Colour(newQColor);
1941 std::ostringstream oss; oss << std::setprecision(2)
1942 << newColour.GetRed() << ' ' << newColour.GetGreen()
1943 << ' ' << newColour.GetBlue() << ' ' << newColour.GetAlpha();
1944 auto uiMan = G4UImanager::GetUIpointer();
1945 uiMan->ApplyCommand("/vis/set/touchable" + sceneTreeItem->GetPVPath());
1946 uiMan->ApplyCommand("/vis/touchable/set/colour " + oss.str());
1947
1948 // Normally the sceneTreeItem will be updated when the scene is processed after the above
1949 // commands, but if the user sets the opacity to zero, G4PhysicalVolumeModel does not
1950 // transmit it (this is because some users set the opacity to zero to make a volume
1951 // invisible - perhaps they should use the visibility flag, but hey-ho).
1952 // By design, the sceneTreeItem remains, so it can still be interacted with, but
1953 // the colour will not be updated, so we do it here.
1954 if (newColour.GetAlpha() == 0.) {
1955 sceneTreeItem->AccessVisAttributes().SetColour(newColour);
1956 }
1957}
1958
1959void G4UIQt::SceneTreeItemExpanded(QTreeWidgetItem* item)
1960{

Callers

nothing calls this directly

Calls 11

ConvertToG4SceneTreeItemFunction · 0.85
ConvertG4ColourToQColorFunction · 0.85
ConvertQColorToG4ColourFunction · 0.85
GetRedMethod · 0.80
GetGreenMethod · 0.80
GetBlueMethod · 0.80
GetTypeMethod · 0.45
GetColourMethod · 0.45
GetAlphaMethod · 0.45
ApplyCommandMethod · 0.45
SetColourMethod · 0.45

Tested by

no test coverage detected