Ignore:
Timestamp:
Jun 8, 2007, 4:43:47 PM (17 years ago)
Author:
garnier
Message:

r588@mac-90108: laurentgarnier | 2007-06-07 18:17:47 +0200
ajout d un splitter, mais comportement etrange

File:
1 edited

Legend:

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

    r494 r495  
    5555#include <QtGui/qpushbutton.h>
    5656#include <QtGui/qlabel.h>
     57#include <QtGui/qsplitter.h>
    5758
    5859#include <stdlib.h>
     
    99100  fMainWindow = new QMainWindow();
    100101  fMainWindow->setWindowTitle( "G4UI Session" );
    101   fMainWindow->setBaseSize(300,200);
    102   QWidget* centralWidget = new QWidget();
    103   QVBoxLayout* vBox = new QVBoxLayout();
     102  fMainWindow->resize(600,400);
     103  QWidget* central = new QWidget();
     104  QWidget* topWidget = new QWidget();
     105  QWidget* bottomWidget = new QWidget();
     106  QVBoxLayout* vBox1 = new QVBoxLayout();
     107  QVBoxLayout* vBox2 = new QVBoxLayout();
     108
     109  QSplitter *splitter = new QSplitter(Qt::Vertical, central);
    104110  fTextArea = new QTextEdit();
    105111  fCommandHistoryArea = new QTextEdit();
     
    118124  connect(fCommandArea, SIGNAL(returnPressed()), SLOT(commandEnteredCallback()));
    119125
    120   vBox->addWidget(fTextArea);
    121   vBox->addWidget(clearButton);
    122   vBox->addWidget(fCommandHistoryArea);
    123   vBox->addWidget(fCommandLabel);
    124   vBox->addWidget(fCommandArea);
    125   centralWidget->setLayout(vBox);
    126   fMainWindow->setCentralWidget(centralWidget);
     126  vBox1->addWidget(fTextArea);
     127  vBox1->addWidget(clearButton);
     128
     129  vBox2->addWidget(fCommandHistoryArea);
     130  vBox2->addWidget(fCommandLabel);
     131  vBox2->addWidget(fCommandArea);
     132
     133  topWidget->setLayout(vBox1);
     134  bottomWidget->setLayout(vBox2);
     135
     136  splitter->addWidget(topWidget);
     137  splitter->addWidget(bottomWidget);
     138
     139  fMainWindow->setCentralWidget(central);
    127140
    128141//  QMainWindow top = (QMainWindow)interactorManager->GetMainInteractor();
     
    302315/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    303316{
    304 // TODO !
    305 //  XmTextAppendString(text,(char*)a_string.data());
    306 //  return 0;
     317  fTextArea->append((char*)a_string.data());
     318  return 0;
    307319}
    308320/***************************************************************************/
     
    316328/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    317329{
    318 // TODO !
    319 //  XmTextAppendString(text,(char*)a_string.data());
    320 //  return 0;
     330  fTextArea->append((char*)a_string.data());
     331  return 0;
    321332}
    322333/***************************************************************************/
     
    419430/*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    420431{
    421  
     432   fCommandHistoryArea->append(fCommandArea->text());
    422433   G4String command (fCommandArea->text().toStdString().c_str());
    423434   if(fHelp==true) {
     
    425436     fHelp = ConvertStringToInt(command.data(),fHelpChoice);
    426437   } else {
    427 printf("*******************3\n");
    428438     ApplyShellCommand (command,exitSession,exitPause);
    429 printf("*******************4\n");
    430439   }
    431 
     440   fCommandArea->setText("");
    432441}
    433442// /***************************************************************************/
     
    514523//   return ss;
    515524//}
    516 // /***************************************************************************/
    517 // void XmTextAppendString (
    518 //  Widget This
    519 // ,char* a_string
    520 // )
    521 // /***************************************************************************/
    522 // /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
    523 // {
    524 //   if(This==NULL) return;
    525 //   if(!XtIsSubclass(This,xmTextWidgetClass)) return;
    526 //   if(a_string==NULL) return;
    527 //   XmTextPosition  lastpos = XmTextGetLastPosition(This);
    528 //   XmTextReplace(This,lastpos,lastpos,a_string);
    529 //   XmTextSetInsertionPosition(This,XmTextGetLastPosition(This));
    530 // }
    531525//////////////////////////////////////////////////////////////////////////////
    532526G4bool ConvertStringToInt(
Note: See TracChangeset for help on using the changeset viewer.