diff options
author | senator <senator> | 2007-07-18 07:52:47 +0000 |
---|---|---|
committer | senator <senator> | 2007-07-18 07:52:47 +0000 |
commit | 37be3663a7bcd8c689a63ad5b2c4b40df2d9e73b (patch) | |
tree | 5784494e0b38b36f0c8ec3756913b16b5ae184f8 /client/widgets/main.cc | |
parent | dd630367a769784e24a41afbf9b36e8ec45512d5 (diff) |
added more dummy widgets and a general widget for use with vector
Diffstat (limited to 'client/widgets/main.cc')
-rw-r--r-- | client/widgets/main.cc | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/client/widgets/main.cc b/client/widgets/main.cc new file mode 100644 index 0000000..fc4603d --- /dev/null +++ b/client/widgets/main.cc @@ -0,0 +1,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++; + } +} |