special case for the "open" icon. It will open a file selector and map the return file to the given command. */
| 3824 | command. |
| 3825 | */ |
| 3826 | void G4UIQt::AddIcon( |
| 3827 | const char* aLabel, const char* aIconFile, const char* aCommand, const char* aFileName) |
| 3828 | { |
| 3829 | if (aLabel == nullptr) return; // TO KEEP |
| 3830 | // special case, aCommand could be NULL if aIconFile is not user_icon |
| 3831 | if (aCommand == nullptr) { |
| 3832 | if (std::string(aIconFile) == "user_icon") { |
| 3833 | return; // TO KEEP |
| 3834 | } |
| 3835 | } |
| 3836 | QPixmap* pix; |
| 3837 | G4bool userToolBar = false; |
| 3838 | |
| 3839 | if (! fDefaultIcons) { |
| 3840 | userToolBar = true; |
| 3841 | } |
| 3842 | if (std::string(aIconFile) == "user_icon") { |
| 3843 | // try to open a file |
| 3844 | G4UImanager* UImanager = G4UImanager::GetUIpointer(); |
| 3845 | pix = new QPixmap(UImanager->FindMacroPath(aFileName).data()); |
| 3846 | if (pix->isNull()) { |
| 3847 | G4int verbose = UImanager->GetVerboseLevel(); |
| 3848 | |
| 3849 | if (verbose >= 2) { |
| 3850 | G4cout << "Warning: file '" << aFileName |
| 3851 | << "' is incorrect or does not exist, this command will not be build" << G4endl; |
| 3852 | } |
| 3853 | return; |
| 3854 | } |
| 3855 | } |
| 3856 | else if (std::string(aIconFile) == "open") { |
| 3857 | pix = fOpenIcon; |
| 3858 | } |
| 3859 | else if (std::string(aIconFile) == "save") { |
| 3860 | pix = fSaveIcon; |
| 3861 | } |
| 3862 | else if (std::string(aIconFile) == "move") { |
| 3863 | pix = fMoveIcon; |
| 3864 | } |
| 3865 | else if (std::string(aIconFile) == "rotate") { |
| 3866 | pix = fRotateIcon; |
| 3867 | } |
| 3868 | else if (std::string(aIconFile) == "pick") { |
| 3869 | pix = fPickIcon; |
| 3870 | } |
| 3871 | else if (std::string(aIconFile) == "zoom_in") { |
| 3872 | pix = fZoomInIcon; |
| 3873 | } |
| 3874 | else if (std::string(aIconFile) == "zoom_out") { |
| 3875 | pix = fZoomOutIcon; |
| 3876 | } |
| 3877 | else if (std::string(aIconFile) == "wireframe") { |
| 3878 | pix = fWireframeIcon; |
| 3879 | } |
| 3880 | else if (std::string(aIconFile) == "solid") { |
| 3881 | pix = fSolidIcon; |
| 3882 | } |
| 3883 | else if (std::string(aIconFile) == "point_cloud") { |
nothing calls this directly
no test coverage detected