Changeset 519 for trunk/geant4/interfaces/basic/src
- Timestamp:
- Jun 20, 2007, 6:41:53 PM (17 years ago)
- Location:
- trunk/geant4/interfaces/basic/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/interfaces/basic/src/G4UIQt.cc
r518 r519 109 109 connect(clearButton, SIGNAL(clicked()), SLOT(clearButtonCallback())); 110 110 111 fCommandHistoryArea = new QTextEdit(); 111 fCommandHistoryArea = new QListWidget(); 112 fCommandHistoryArea->setSelectionMode(QAbstractItemView::SingleSelection); 113 connect(fCommandHistoryArea, SIGNAL(itemSelectionChanged()), SLOT(commandHistoryCallback())); 112 114 fCommandLabel = new QLabel(); 113 115 114 // fCommandArea = new G4UIQtLineEdit(this); // must surcharge the keyPressEvent function115 116 fCommandArea = new QLineEdit(); 116 117 fCommandArea->installEventFilter(this); … … 120 121 fCommandArea->setFocus(Qt::TabFocusReason); 121 122 fTextArea->setReadOnly(true); 122 fCommandHistoryArea->setReadOnly(true); 123 124 // virtual void keyPressEvent(QKeyEvent *e) { 125 // if (e->key == Qt::Key_F9) { 126 // Do something 127 //} 128 //} 123 129 124 130 125 // Set layouts … … 375 370 G4UIcommandTree * treeTop = UI->GetTree(); 376 371 377 378 // en test : creation de doc html379 380 381 treeTop->CreateHTML();382 printf("************ create file : -%s-**********\n",((char*)treeTop->GetPathName().data()));383 384 385 386 387 388 389 390 //391 372 // build widget 392 373 fHelpTreeWidget = new QTreeWidget(); … … 592 573 { 593 574 printf("G4UIQt::GetHelpChoice SHOULD NEVER GO HERE"); 594 } 575 return true; 576 } 577 595 578 /***************************************************************************/ 596 579 void G4UIQt::ExitHelp( … … 622 605 if (event->type() == QEvent::KeyPress) { 623 606 QKeyEvent *e = static_cast<QKeyEvent*>(event); 624 if (e->key() == (Qt::Key_Down)) { 625 printf("****************KEY PRESSED DOWN*****\n"); 626 } else if (e->key() == (Qt::Key_PageDown)) { 627 printf("****************KEY PRESSED PAGE DOWN*****\n"); 628 } else if (e->key() == (Qt::Key_Up)) { 629 printf("****************KEY PRESSED UP*****\n"); 630 } else if (e->key() == (Qt::Key_PageUp)) { 631 printf("****************KEY PRESSED PAGE UP*****\n"); 632 // } else { 633 // return QObject::eventFilter(obj, event); 607 if ((e->key() == (Qt::Key_Down)) || 608 (e->key() == (Qt::Key_PageDown)) || 609 (e->key() == (Qt::Key_Up)) || 610 (e->key() == (Qt::Key_PageUp))) { 611 int selection = fCommandHistoryArea->currentRow(); 612 printf("-selection : %d\n",selection); 613 if (fCommandHistoryArea->count()) { 614 if (selection == -1) { 615 selection = fCommandHistoryArea->count()-1; 616 } 617 printf("selection : %d\n",selection); 618 if (e->key() == (Qt::Key_Down)) { 619 printf("****************KEY PRESSED DOWN*****%d <= %d\n",selection,fCommandHistoryArea->count()); 620 if (selection <(fCommandHistoryArea->count()-1)) 621 selection++; 622 } else if (e->key() == (Qt::Key_PageDown)) { 623 selection = fCommandHistoryArea->count()-1; 624 printf("****************KEY PRESSED PAGE DOWN*****\n"); 625 } else if (e->key() == (Qt::Key_Up)) { 626 if (selection >0) 627 selection --; 628 printf("****************KEY PRESSED UP*****\n"); 629 } else if (e->key() == (Qt::Key_PageUp)) { 630 selection = 0; 631 printf("****************KEY PRESSED PAGE UP*****\n"); 632 } 633 fCommandHistoryArea->clearSelection(); 634 fCommandHistoryArea->item(selection)->setSelected(true); 635 } 634 636 } 635 // } else {636 // return QObject::eventFilter(obj, event);637 637 } 638 // } else {639 }638 } 639 640 640 // pass the event on to the parent class 641 641 return QObject::eventFilter(obj, event); 642 // return true;643 642 } 644 643 … … 683 682 G4String command (fCommandArea->text().toStdString().c_str()); 684 683 if (fCommandArea->text().toStdString().c_str() != "") { 685 fCommandHistoryArea->a ppend(fCommandArea->text());684 fCommandHistoryArea->addItem(fCommandArea->text()); 686 685 687 686 if (command(0,4) != "help") { … … 750 749 751 750 751 752 void G4UIQt::commandHistoryCallback( 753 ) 754 /***************************************************************************/ 755 /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ 756 { 757 // G4bool GetHelpChoice(G4int&); 758 QListWidgetItem* item = NULL; 759 if (!fCommandHistoryArea) 760 return ; 761 762 763 QList<QListWidgetItem *> list =fCommandHistoryArea->selectedItems(); 764 if (list.isEmpty()) 765 return; 766 item = list.first(); 767 if (!item) 768 return; 769 fCommandArea->setText(item->text()); 770 771 } 772 752 773 #endif -
trunk/geant4/interfaces/basic/src/G4UIQt_moc.cc
r516 r519 2 2 ** Meta object code from reading C++ file 'G4UIQt.hh' 3 3 ** 4 ** Created: Tue Jun 19 15:07:5220074 ** Created: Wed Jun 20 18:07:19 2007 5 5 ** by: The Qt Meta Object Compiler version 59 (Qt 4.2.2) 6 6 ** … … 23 23 0, // classname 24 24 0, 0, // classinfo 25 6, 10, // methods25 7, 10, // methods 26 26 0, 0, // properties 27 27 0, 0, // enums/sets … … 36 36 103, 31, 31, 31, 0x08, 37 37 122, 31, 31, 31, 0x08, 38 141, 31, 31, 31, 0x08, 38 39 39 40 0 // eod … … 44 45 "clearButtonCallback()\0commandEnteredCallback()\0" 45 46 "buttonCallback(QString)\0helpTreeCallback()\0" 46 "showHelpCallback()\0 "47 "showHelpCallback()\0commandHistoryCallback()\0" 47 48 }; 48 49 … … 82 83 case 4: helpTreeCallback(); break; 83 84 case 5: showHelpCallback(); break; 85 case 6: commandHistoryCallback(); break; 84 86 } 85 _id -= 6;87 _id -= 7; 86 88 } 87 89 return _id;
Note: See TracChangeset
for help on using the changeset viewer.