42 QString func,QString ttext,QString tbutt1,QString tbutt2,QList<QPixmap *> *toolbuttons,
int xsize,
int ysize)
44 sdebug(
"*** HDialog::makeGui ***");
46 if(func.contains(
"EscC"))
49 if(func.contains(
"TB1cl"))
51 if(func.contains(
"TB1Close"))
53 if(func.contains(
"TB2cl"))
55 if(func.contains(
"TB2Close"))
58 if(func.contains(
"TB1AcceptClose"))
60 if(func.contains(
"TB2AcceptClose"))
63 if(func.contains(
"InScroll"))
65 if(func.contains(
"DeleteData"))
67 if(func.contains(
"DestructiveClose"))
70 basew->setWindowTitle(caption.isEmpty() ?
"Dialog..." : caption );
79 sv1 =
new QScrollArea(basew);
82 sv1->setWidget(table1);
83 sv1->setWidgetResizable(
true);
88 if(func.contains(
"StrToE"))
94 basew->connect(list1,SIGNAL(listItemChanged()),basew,SLOT(lic()));
96 if(dobj1->
getWhoami() ==
"HPlainDataMatrix")
108 sv2 =
new QScrollArea(basew);
110 sv2->setWidget(table2);
111 sv2->setWidgetResizable(
true);
116 if(func.contains(
"StrToE"))
122 basew->connect(list2,SIGNAL(listItemChanged()),basew,SLOT(lic()));
124 if(dobj2->
getWhoami() ==
"HPlainDataMatrix")
133 if(!tbutt1.isEmpty())
134 toolbutton1 =
new QPushButton(tbutt1,basew);
136 if(!tbutt2.isEmpty())
137 toolbutton2 =
new QPushButton(tbutt2,basew);
140 QVBoxLayout *mainLayout =
new QVBoxLayout(basew);
144 QBoxLayout *titleLayout =
new QHBoxLayout(0);
145 titleLayout->setMargin(5);
146 titleLayout->setSpacing(5);
147 titleLayout->addStretch();
148 titleLayout->addWidget(
new QLabel(ttext,basew));
149 titleLayout->addStretch();
150 mainLayout->addLayout(titleLayout);
157 QHBoxLayout *pixtoollay =
new QHBoxLayout(0);
158 pixtoollay->setMargin(2);
159 pixtoollay->setSpacing(2);
162 if(func.contains(
"ToolCenter"))
163 pixtoollay->addStretch();
164 for(i=0;i<(int)toolbuttons->count();i++)
166 sdebug(QString(
"Pixmap toolbutton %1 initializing...").arg(i));
167 pixTool[i] =
new QToolButton(basew);
168 pixTool[i]->setIcon( *(toolbuttons->at(i)));
169 pixTool[i]->resize(25,25);
170 pixtoollay->addWidget(pixTool[i]);
173 pixtoollay->addStretch();
174 mainLayout->addLayout(pixtoollay);
177 if(table1 != NULL || table2 != NULL || list1 != NULL || list2 != NULL || dmatrix1 != NULL || dmatrix2 != NULL)
179 QBoxLayout *dviewLayout;
180 if(func.contains(
"DHoriz"))
181 dviewLayout =
new QHBoxLayout(0);
183 dviewLayout =
new QVBoxLayout(0);
185 dviewLayout->setMargin(5);
186 dviewLayout->setSpacing(5);
188 dviewLayout->addWidget(inscroll ? (QWidget *)sv1 : (QWidget *)table1);
190 dviewLayout->addWidget(list1 );
192 dviewLayout->addWidget(dmatrix1);
195 dviewLayout->addWidget(inscroll ? (QWidget *)sv2 : (QWidget *)table2);
197 dviewLayout->addWidget(list2 );
199 dviewLayout->addWidget(dmatrix2);
201 mainLayout->addLayout(dviewLayout);
204 if(toolbutton1 != NULL || toolbutton2 != NULL)
206 QBoxLayout *toolLayout;
207 if(func.contains(
"THoriz"))
208 toolLayout =
new QHBoxLayout(0);
210 toolLayout =
new QVBoxLayout(0);
211 toolLayout->setMargin(5);
212 toolLayout->setSpacing(5);
213 if(func.contains(
"THoriz"))
214 toolLayout->addStretch();
215 if(toolbutton1 != NULL)
216 toolLayout->addWidget(toolbutton1);
217 if(toolbutton2 != NULL)
218 toolLayout->addWidget(toolbutton2);
219 if(func.contains(
"THoriz"))
220 toolLayout->addStretch();
221 mainLayout->addLayout(toolLayout);
224 if(func.contains(
"Ok"))
226 closebutton =
new QPushButton(
"Ok",basew);
228 QBoxLayout *closeLayout =
new QHBoxLayout(0);
229 closeLayout->setMargin(5);
230 closeLayout->setSpacing(5);
231 closeLayout->addStretch();
232 closeLayout->addWidget(closebutton);
233 closeLayout->addStretch();
234 mainLayout->addLayout(closeLayout);
239 if(closebutton != NULL)
241 if(func.contains(
"OkIsAccept"))
243 if(!basew->connect(closebutton,SIGNAL(clicked()),basew,SLOT(accept())))
244 error(
"In HDialogData::makeGui cannot connect: closebutton,SIGNAL(clicked()) to basew,SLOT(accept()) !");
248 if(!basew->connect(closebutton,SIGNAL(clicked()),basew,SLOT(close())))
249 error(
"In HDialogData::makeGui cannot connect: closebutton,SIGNAL(clicked()) to basew,SLOT(close()) !");
252 if(toolbutton1 != NULL)
253 basew->connect(toolbutton1,SIGNAL(clicked()),basew,SLOT(tbutton1Cl()));
254 if(toolbutton2 != NULL)
255 basew->connect(toolbutton2,SIGNAL(clicked()),basew,SLOT(tbutton2Cl()));
257 if(xsize != 0 || ysize != 0)
258 basew->resize(xsize,ysize);
260 sdebug(
"*** HDialog::makeGui *** END");
266 QString ttext,QString tbutt1,QString tbutt2,QList<QPixmap *> *toolbuttons,
int xsize,
int ysize)
271 if(func.contains(
"AutoExec"))
273 error(
"Do not pass \"AutoExec\" option to HDialog::run !");
277 d =
new HDialog(parent,caption,dobj1,dobj2,func,ttext,tbutt1,tbutt2,toolbuttons,xsize,ysize);
286 QString ttext,QString tbutt1,QString tbutt2,QList<QPixmap *> *toolbuttons,
int xsize,
int ysize)
287 : QDialog(parent,Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint),
290 sdebug(
"*** HDialog::HDialog ***");
292 if(!func.contains(
"NonModal"))
297 makeGui(
this,caption,dobj1,dobj2,func,ttext,tbutt1,tbutt2,toolbuttons,xsize,ysize);
300 setAttribute(Qt::WA_DeleteOnClose);
302 setSizeGripEnabled(
true);
305 if(func.contains(
"AutoExec"))
307 sdebug(
"*** HDialog::HDialog *** END");
312 sdebug(
"*** HDialog::HDialog ***");
313 sdebug(
"*** HDialog::HDialog *** END");
316 int HDialog::lic(
void)
323 int HDialog::tbutton1Cl(
void)
339 int HDialog::tbutton2Cl(
void)
355 void HDialog::keyPressEvent(QKeyEvent *e)
357 if(e->key() == Qt::Key_Escape)
367 QDialog::keyPressEvent(e);
382 QVBoxLayout *mainlay =
new QVBoxLayout(
this);
383 mainlay->setMargin(5);
384 mainlay->setSpacing(5);
385 QHBoxLayout *toplay =
new QHBoxLayout(0);
386 toplay->setMargin(5);
387 toplay->setSpacing(5);
388 QLabel *label =
new QLabel(text,
this);
389 toplay->addStretch();
390 toplay->addWidget(label);
391 toplay->addStretch();
392 mainlay->addLayout(toplay);
395 QVBoxLayout *leftlay =
new QVBoxLayout(0);
396 leftlay->setMargin(5);
397 leftlay->setSpacing(5);
399 QVBoxLayout *rightlay =
new QVBoxLayout(0);
400 rightlay->setMargin(5);
401 rightlay->setSpacing(5);
403 size=(int)exptexts.size();
406 QHBoxLayout *midlay =
new QHBoxLayout(0);
407 midlay->setMargin(5);
408 midlay->setSpacing(5);
409 QLabel *sublabel =
new QLabel(exptexts[i],
this);
413 QTextEdit *mline =
new QTextEdit(
"",
this);
414 leftlay->addWidget(sublabel);
415 rightlay->addWidget(mline);
417 mledits.push_back(mline);
421 QLineEdit *line =
new QLineEdit(
"",
this);
422 leftlay->addWidget(sublabel);
423 rightlay->addWidget(line);
425 ledits.push_back(line);
430 QHBoxLayout *midlay =
new QHBoxLayout(0);
431 midlay->setMargin(5);
432 midlay->setSpacing(5);
434 midlay->addLayout(leftlay);
435 midlay->addStretch();
436 midlay->addLayout(rightlay);
437 mainlay->addLayout(midlay);
439 QHBoxLayout *sublay =
new QHBoxLayout(0);
440 sublay->setMargin(5);
441 sublay->setSpacing(5);
443 QPushButton *button =
new QPushButton(
"Ok",
this);
444 sublay->addStretch();
445 sublay->addWidget(button);
446 sublay->addStretch();
447 mainlay->addLayout(sublay);
449 connect(button,SIGNAL(clicked()),
this,SLOT(clickOk()));
452 int HGetTextBox::clickOk(
void)
458 size=(int)mledits.size();
462 results.push_back(mledits[i]->toPlainText());
468 size=(int)ledits.size();
472 results.push_back(ledits[i]->text());
static int run(QWidget *parent=0, QString caption=0, HBase *dobj1=NULL, HBase *dobj2=NULL, QString func="Ok|EscC|Vert", QString ttext="", QString tbutt1="", QString tbutt2="", QList< QPixmap * > *toolbuttons=NULL, int xsize=320, int ysize=240)
HDialog(QWidget *parent=0, QString caption=0, HBase *dobj1=NULL, HBase *dobj2=NULL, QString func="Ok|EscC|Vert", QString ttext="", QString tbutt1="", QString tbutt2="", QList< QPixmap * > *toolbuttons=NULL, int xsize=320, int ysize=240)
void listItemChanged(void)
int addStretchToEnd(void)
int makeGui(QWidget *basew, QString caption=0, HBase *dobj1=NULL, HBase *dobj2=NULL, QString func="Ok|EscC|Vert", QString ttext="", QString tbutt1="", QString tbutt2="", QList< QPixmap * > *toolbuttons=NULL, int xsize=320, int ysize=240)
void tbutton2Clicked(void)
HGetTextBox(QWidget *parent, QString cap, QString text, QList< QString > exptexts, bool largetexts=false)
void tbutton1Clicked(void)