GSI Object Oriented Online Offline (Go4)  GO4-5.3.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QRootDialog.cpp
Go to the documentation of this file.
1 // $Id: QRootDialog.cpp 1134 2014-01-22 14:53:40Z linev $
2 //-----------------------------------------------------------------------
3 // The GSI Online Offline Object Oriented (Go4) Project
4 // Experiment Data Processing at EE department, GSI
5 //-----------------------------------------------------------------------
6 // Copyright (C) 2000- GSI Helmholtzzentrum für Schwerionenforschung GmbH
7 // Planckstr. 1, 64291 Darmstadt, Germany
8 // Contact: http://go4.gsi.de
9 //-----------------------------------------------------------------------
10 // This software can be used under the license agreements as stated
11 // in Go4License.txt file which is part of the distribution.
12 //-----------------------------------------------------------------------
13 
14 //Author : Denis Bertini 01.11.2000
15 
16 /**************************************************************************
17 * Copyright (C) 2000- Gesellschaft f. Schwerionenforschung, GSI *
18 * Planckstr. 1, 64291 Darmstadt, Germany *
19 * All rights reserved. *
20 * Contact: http://go4.gsi.de *
21 * *
22 * This software can be used under the license agreements as stated in *
23 * Go4License.txt file which is part of the distribution. *
24 ***************************************************************************/
25 
26 #include "QRootDialog.h"
27 
28 #include <QGridLayout>
29 #include <QVBoxLayout>
30 #include <QHBoxLayout>
31 #include <QLabel>
32 #include <QPushButton>
33 #include <QLineEdit>
34 
35 
37 {
38  QGridLayout *gridLayout = new QGridLayout(this);
39  gridLayout->setSpacing(1);
40  gridLayout->setMargin(1);
41 
42  QHBoxLayout *buttLayout = new QHBoxLayout();
43 
44  QPushButton *bOk = new QPushButton(this);
45  bOk->setText("Apply");
46  connect(bOk, SIGNAL( clicked() ), this, SLOT( accept() ));
47  buttLayout->addWidget(bOk);
48 
49  QPushButton *bCancel = new QPushButton(this);
50  bCancel->setText("Cancel");
51  connect(bCancel, SIGNAL( clicked() ), this, SLOT( reject() ));
52  buttLayout->addWidget(bCancel);
53 
54  argLayout = new QVBoxLayout();
55 
56  setSizePolicy(QSizePolicy(QSizePolicy::Expanding,
57  QSizePolicy::Expanding));
58 
59  gridLayout->addLayout(argLayout, 0, 0);
60  gridLayout->addLayout(buttLayout, 1, 0, Qt::AlignBottom);
61 }
62 
63 void QRootDialog::addArg(const char* argname, const char* value, const char*)
64 {
65  QLabel* lbl = new QLabel(argname);
66  argLayout->addWidget(lbl);
67 
68  QLineEdit* le = new QLineEdit();
69  le->setGeometry(10,10, 130, 30);
70  le->setFocus();
71  le->setText(value);
72  argLayout->addWidget(le);
73 
74  fArgs.push_back(le);
75 }
76 
77 QString QRootDialog::getArg(int n)
78 {
79  if ((n<0) || (n>=fArgs.size())) return QString("");
80  return fArgs[n]->text();
81 }
QVBoxLayout * argLayout
Definition: QRootDialog.h:60
QString getArg(int n)
Definition: QRootDialog.cpp:77
void addArg(const char *argname, const char *value, const char *type)
Definition: QRootDialog.cpp:63
QVector< QLineEdit * > fArgs
Definition: QRootDialog.h:62