Changeset 494 for trunk/geant4/interfaces
- Timestamp:
- Jun 8, 2007, 4:43:45 PM (17 years ago)
- Location:
- trunk/geant4/interfaces/basic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/interfaces/basic/GNUmakefile
r493 r494 3 3 # GNUmakefile for interfaces/basic library. John Allison, 6/7/98. 4 4 5 ifdef G4UI_USE_QT5 #ifdef G4UI_USE_QT 6 6 # This is not good solution, we have to 'make' twice, but it works... 7 moc :8 @$(MOC) -DG4UI_USE_QT include/G4UIQt.hh -o src/G4UIQt_moc.cc9 endif7 #moc : 8 # @$(MOC) -DG4UI_USE_QT include/G4UIQt.hh -o src/G4UIQt_moc.cc 9 #endif 10 10 11 11 name := G4UIbasic -
trunk/geant4/interfaces/basic/include/G4UIQt.hh
r491 r494 41 41 #include <QtGui/qlineedit.h> 42 42 #include <QtGui/qtextedit.h> 43 #include <QtGui/qlabel.h> 43 44 #include <QObject> 44 45 … … 104 105 G4bool fHelp; 105 106 G4int fHelpChoice; 106 QMainWindow * mainWindow; 107 QLineEdit * promptArea; 108 QTextEdit *textArea; 107 QMainWindow * fMainWindow; 108 QLabel *fCommandLabel; 109 QLineEdit * fCommandArea; 110 QTextEdit *fTextArea; 111 QTextEdit *fCommandHistoryArea; 109 112 110 113 private slots : 111 114 void clearButtonCallback(); 115 void commandEnteredCallback(); 112 116 }; 113 117 -
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r491 r494 77 77 | | clear | | 78 78 | +-------------------+ | 79 | | promt history | | 80 | +-------------------+ | 81 | +-------------------+ | 79 82 | |> promt area | | 80 83 | +-------------------+ | … … 94 97 G4Qt* interactorManager = G4Qt::getInstance (argc,argv,(char*)"Qt"); // TO KEEP ? 95 98 96 mainWindow = new QMainWindow();97 mainWindow->setWindowTitle( "G4UI Session" );98 mainWindow->setBaseSize(300,200);99 fMainWindow = new QMainWindow(); 100 fMainWindow->setWindowTitle( "G4UI Session" ); 101 fMainWindow->setBaseSize(300,200); 99 102 QWidget* centralWidget = new QWidget(); 100 103 QVBoxLayout* vBox = new QVBoxLayout(); 101 textArea = new QTextEdit(); 102 QLabel *sessionLabel = new QLabel("Session : "); 104 fTextArea = new QTextEdit(); 105 fCommandHistoryArea = new QTextEdit(); 106 fCommandLabel = new QLabel(); 107 103 108 QPushButton *clearButton = new QPushButton("clear"); 104 109 connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonCallback())); 105 110 111 fTextArea->setReadOnly(true); 112 fCommandHistoryArea->setReadOnly(true); 113 106 114 // QMenu *menuFile = new QMenu("File"); 107 // mainWindow->menuBar()->addMenu(menuFile); 108 109 promptArea = new QLineEdit(); 110 textArea->setReadOnly(FALSE); 111 vBox->addWidget(textArea); 115 // fMainWindow->menuBar()->addMenu(menuFile); 116 117 fCommandArea = new QLineEdit(); 118 connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback())); 119 120 vBox->addWidget(fTextArea); 112 121 vBox->addWidget(clearButton); 113 vBox->addWidget(sessionLabel); 114 vBox->addWidget(promptArea); 122 vBox->addWidget(fCommandHistoryArea); 123 vBox->addWidget(fCommandLabel); 124 vBox->addWidget(fCommandArea); 115 125 centralWidget->setLayout(vBox); 116 mainWindow->setCentralWidget(centralWidget);126 fMainWindow->setCentralWidget(centralWidget); 117 127 118 128 // QMainWindow top = (QMainWindow)interactorManager->GetMainInteractor(); … … 202 212 203 213 204 if ( mainWindow!=NULL)205 delete mainWindow;214 if (fMainWindow!=NULL) 215 delete fMainWindow; 206 216 } 207 217 /***************************************************************************/ … … 215 225 { 216 226 217 mainWindow->show(); 227 fMainWindow->show(); 228 Prompt("session"); 229 exitSession = false; 218 230 qApp->exec(); 219 231 220 // Prompt("session"); // TO KEEP221 // exitSession = false; // TO KEEP222 232 // interactorManager->DisableSecondaryLoop (); // TO KEEP 223 233 // void* event; // TO KEEP … … 230 240 } 231 241 /***************************************************************************/ 242 232 243 /** 233 244 Display the prompt in the prompt area … … 239 250 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 240 251 { 241 // TODO ! 242 // Arg args[1]; 243 // char* str = (char*)XtNewString(aPrompt.data()); 244 // XmString cps = XmStringLtoRCreate(str,XmSTRING_DEFAULT_CHARSET); 245 // XtFree(str); 246 // XtSetArg(args[0],XmNpromptString,cps); 247 // XtSetValues(command,args,1); 248 // XmStringFree(cps); 252 fCommandLabel->setText((char*)aPrompt.data()); 249 253 } 250 254 /***************************************************************************/ … … 404 408 /***************************************************************************/ 405 409 /***************************************************************************/ 410 406 411 /** 407 Callback call when "enter" clicked on the promptzone.412 Callback call when "enter" clicked on the command zone. 408 413 Send the command to geant4 409 414 */ 410 415 // TODO ! 411 //void G4UIQt::commandEnteredCallback ( 412 // Widget a_widget 413 //,XtPointer a_tag 414 //,XtPointer a_data 415 //) 416 /***************************************************************************/ 417 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 418 //{ 419 // G4UIQt* This = (G4UIQt*)a_tag; 420 421 // XmString cps = ((XmCommandCallbackStruct*)a_data)->value; 422 // char* ss = XmConvertCompoundStringToString(cps,0); 423 // G4String command (ss); 424 // XtFree (ss); 425 426 // if(This->fHelp==true) { 427 // exitHelp = true; 428 // This->fHelp = ConvertStringToInt(command.data(),This->fHelpChoice); 429 // } else { 430 // This->ApplyShellCommand (command,exitSession,exitPause); 431 // } 432 433 // a_widget = NULL; 434 // a_tag = NULL; 435 //} 416 void G4UIQt::commandEnteredCallback ( 417 ) 418 /***************************************************************************/ 419 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 420 { 421 422 G4String command (fCommandArea->text().toStdString().c_str()); 423 if(fHelp==true) { 424 exitHelp = true; 425 fHelp = ConvertStringToInt(command.data(),fHelpChoice); 426 } else { 427 printf("*******************3\n"); 428 ApplyShellCommand (command,exitSession,exitPause); 429 printf("*******************4\n"); 430 } 431 432 } 436 433 // /***************************************************************************/ 437 434 // void G4UIXm::keyHandler ( … … 461 458 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 462 459 { 463 textArea->clear();460 fTextArea->clear(); 464 461 } 465 462
Note: See TracChangeset
for help on using the changeset viewer.