// BLCMDqt.cc /* This source file is part of G4beamline, http://g4beamline.muonsinc.com Copyright (C) 2003,2004,2005,2006 by Tom Roberts, all rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. http://www.gnu.org/copyleft/gpl.html */ #if defined(G4UI_USE_QT) || defined(G4VIS_USE_OPENGLQT) #include #include "G4Qt.hh" #include "G4UIQt.hh" #include "G4UIsession.hh" #include "BLManager.hh" #include "BLParam.hh" /** class BLCMDqt creates the Qt instance. **/ class BLCMDqt : public BLCommand, public BLCallback { public: /// Constructor. BLCMDqt(); /// commandName() returns "qt". virtual G4String commandName() { return "qt"; } /// command() implements the qt command. virtual int command(BLArgumentVector& argv, BLArgumentMap& namedArgs); /// defineNamedArgs() defines the named arguments for this command. virtual void defineNamedArgs() { } /// callback() from BLCallback. void callback(int type); }; BLCMDqt defaultQt; BLCMDqt::BLCMDqt() { registerCommand(BLCMDTYPE_CONTROL); setSynopsis("Constructs the Qt instance."); setDescription(""); } int BLCMDqt::command(BLArgumentVector& argv, BLArgumentMap& namedArgs) { BLManager::getObject()->registerCallback(this, 1); printf("qt\n"); return 0; } void BLCMDqt::callback(int type) { char *argv[2] = { 0, 0}; argv[0] = (char *)"g4beamline"; printf("qt: creating the Qt user interface...\n"); G4UIQt *ui = new G4UIQt(1,argv); G4UIsession *session = ui->SessionStart(); } #else int dummyQt=0; #endif