Ignore:
Timestamp:
Jun 12, 2007, 10:34:30 AM (17 years ago)
Author:
garnier
Message:

r604@mac-90108: laurentgarnier | 2007-06-11 15:03:21 +0200
Qcolor ok, scrolling ok, reste le focus qui n est pas automatique

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/geant4/interfaces/basic/src/G4UIQt.cc

    r499 r500  
    5656#include <QtGui/qlabel.h>
    5757#include <QtGui/qsplitter.h>
    58 #include <QtGui/qlistview.h> // en test
    59 #include <QtGui/qtreeview.h> // en test
     58#include <QtGui/qscrollbar.h>
    6059
    6160#include <stdlib.h>
     
    101100  fMainWindow = new QMainWindow();
    102101  fMainWindow->setWindowTitle( "G4UI Session" );
    103 
    104 
    105   /*
    106     QSplitter *splitter = new QSplitter(Qt::Vertical,central);
    107     splitter->setMaximumSize(800,800);
    108     QListView *listview = new QListView;
    109     listview->setMaximumSize(800,800);
    110     QTreeView *treeview = new QTreeView;
    111     treeview->setMaximumSize(800,800);
    112   */
     102  fMainWindow->resize(800,600);
     103
    113104  QSplitter *splitter = new QSplitter(Qt::Vertical);
    114105  fTextArea = new QTextEdit();
     
    120111
    121112  fCommandArea = new QLineEdit();
     113  fCommandArea->activateWindow();
    122114  connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback()));
    123 
     115  fCommandArea->setFocusPolicy ( Qt::StrongFocus );
     116  fCommandArea->setFocus(Qt::TabFocusReason);
    124117  fTextArea->setReadOnly(true);
    125118  fCommandHistoryArea->setReadOnly(true);
     
    292285/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    293286{
    294   //  fCommandLabel->setText((char*)aPrompt.data());
     287  fCommandLabel->setText((char*)aPrompt.data());
    295288}
    296289/***************************************************************************/
     
    344337/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    345338{
    346   fTextArea->append((char*)a_string.data());
     339  fTextArea->append(QString((char*)a_string.data()).trimmed());
     340  fTextArea->verticalScrollBar()->setSliderPosition(fTextArea->verticalScrollBar()->maximum());
    347341  return 0;
    348342}
     
    357351/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    358352{
    359   fTextArea->append((char*)a_string.data());
     353  QColor previousColor = fTextArea->textColor();
     354  fTextArea->setTextColor(Qt::red);
     355  fTextArea->append(QString((char*)a_string.data()).trimmed());
     356  fTextArea->setTextColor(previousColor);
    360357  return 0;
    361358}
     
    459456/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    460457{
    461   /*   fCommandHistoryArea->append(fCommandArea->text());
    462    G4String command (fCommandArea->text().toStdString().c_str());
    463    if(fHelp==true) {
    464      exitHelp = true;
    465      fHelp = ConvertStringToInt(command.data(),fHelpChoice);
    466    } else {
    467      ApplyShellCommand (command,exitSession,exitPause);
    468    }
    469    fCommandArea->setText("");
    470   */
     458  G4String command (fCommandArea->text().toStdString().c_str());
     459  if (fCommandArea->text().toStdString().c_str() != "") {
     460    fCommandHistoryArea->append(fCommandArea->text());
     461    if(fHelp==true) {
     462      exitHelp = true;
     463      fHelp = ConvertStringToInt(command.data(),fHelpChoice);
     464    } else {
     465      ApplyShellCommand (command,exitSession,exitPause);
     466    }
     467  }
     468  fCommandArea->setText("");
    471469}
    472470// /***************************************************************************/
Note: See TracChangeset for help on using the changeset viewer.