summaryrefslogtreecommitdiff
path: root/client/widgets/main.cc
blob: fc4603db605eb3d177077cefeb71fbfe903191d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "widget.h"
#include "label.h"
#include "lineedit.h"
#include "pushbutton.h"
#include <QApplication>
#include <QVBoxLayout>
#include <vector>

std::vector< Widget* > widgets;

int main(int argc, char *argv[])
{
  QApplication app(argc, argv);

  QWidget widget;
  QVBoxLayout *layout = new QVBoxLayout();

  Label *label = new Label(&widget, "Test label:", "center");
  LineEdit *lineedit = new LineEdit(&widget, "[0-9]+");
  widgets.push_back(lineedit);
  LineEdit *lineedit2 = new LineEdit(&widget, "[0-9]+");
  widgets.push_back(lineedit2);
  PushButton *pushbutton = new PushButton(&widget, "Commit", "committer");
  widgets.push_back(pushbutton);

  layout->addWidget(label);
  layout->addWidget(lineedit);
  layout->addWidget(lineedit2);
  layout->addWidget(pushbutton);

  widget.setLayout(layout);
  widget.show();

  app.exec();

  std::vector< Widget* >::iterator i=widgets.begin();
  while (i != widgets.end()) {
    Widget* w = *i;
    printf("%s = %s\n", w->getName().toStdString().c_str(), w->getValue().toStdString().c_str());
    i++;
  }
}