diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-02-12 03:50:42 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:12:08 +0300 |
commit | 9ad3df3f6bf98141d65eb1346262f1544bd659d6 (patch) | |
tree | b3af9bf3a22b0504a9f44b6a9ab9f0971b15d257 /qt/info_dialog.cpp | |
parent | 53653a77cc5b64f67301fef7e6919f5f95948243 (diff) |
[QT] Added welcome dialog on first launch
Diffstat (limited to 'qt/info_dialog.cpp')
-rw-r--r-- | qt/info_dialog.cpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/qt/info_dialog.cpp b/qt/info_dialog.cpp new file mode 100644 index 0000000000..82770dd59d --- /dev/null +++ b/qt/info_dialog.cpp @@ -0,0 +1,58 @@ +#include "info_dialog.hpp" + +#include <QtGui/QIcon> +#include <QtGui/QTextEdit> +#include <QtGui/QPushButton> +#include <QtGui/QHBoxLayout> +#include <QtGui/QVBoxLayout> + +#include <QtGui/QLabel> + +namespace qt +{ + InfoDialog::InfoDialog(QString const & title, QString const & text, QWidget * parent) + : QDialog(parent) + { + QIcon icon(":logo.png"); + setWindowIcon(icon); + setWindowTitle(title); + +// QTextEdit * textEdit = new QTextEdit(text, this); +// textEdit->setReadOnly(true); + + QVBoxLayout * vBox = new QVBoxLayout(); + QLabel * label = new QLabel(text); + vBox->addWidget(label); + //vBox->addWidget(textEdit); + // this horizontal layout is for buttons + QHBoxLayout * hBox = new QHBoxLayout(); + vBox->addLayout(hBox); + + setLayout(vBox); + } + + void InfoDialog::OnButtonClick(bool) + { + // @TODO determine which button is pressed + done(0); + } + + void InfoDialog::SetCustomButtons(QStringList const & buttons) + { + QLayout * hBox = layout()->layout(); + // @TODO clear old buttons if any +// for (int i = 0; i < hBox->count(); ++i) +// { +// QLayoutItem * item = hBox->itemAt(i); +// hBox->removeItem(item); +// delete item; +// } + + for (int i = 0; i < buttons.size(); ++i) + { + QPushButton * button = new QPushButton(buttons[i]); + connect(button, SIGNAL(clicked(bool)), this, SLOT(OnButtonClick(bool))); + hBox->addWidget(button); + } + } +} |