diff options
author | Alex Zolotarev <deathbaba@gmail.com> | 2011-02-19 13:15:07 +0300 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:12:39 +0300 |
commit | 6d74c073e1270f10a69aef3d5cc6910f1699cfad (patch) | |
tree | 474e7287336e58a3350dbde973f2331948d5b0cc /qt/info_dialog.cpp | |
parent | d87fba4671b9b696c9700f32f70b5da09539940a (diff) |
Minor Refactoring for update check notification mechanism
Diffstat (limited to 'qt/info_dialog.cpp')
-rw-r--r-- | qt/info_dialog.cpp | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/qt/info_dialog.cpp b/qt/info_dialog.cpp index edf739f711..22250ff729 100644 --- a/qt/info_dialog.cpp +++ b/qt/info_dialog.cpp @@ -10,12 +10,14 @@ namespace qt { - InfoDialog::InfoDialog(QString const & title, QString const & text, QWidget * parent) + InfoDialog::InfoDialog(QString const & title, QString const & text, QWidget * parent, + QStringList const & buttons) : QDialog(parent) { QIcon icon(":logo.png"); setWindowIcon(icon); setWindowTitle(title); + setFocus(); QVBoxLayout * vBox = new QVBoxLayout(); QLabel * label = new QLabel(text); @@ -24,8 +26,15 @@ namespace qt // this horizontal layout is for buttons QHBoxLayout * hBox = new QHBoxLayout(); - vBox->addLayout(hBox); + hBox->addSpacing(label->width() / 4 * (3.5 - buttons.size())); + for (int i = 0; i < buttons.size(); ++i) + { + QPushButton * button = new QPushButton(buttons[i], this); + connect(button, SIGNAL(clicked()), this, SLOT(OnButtonClick())); + hBox->addWidget(button); + } + vBox->addLayout(hBox); setLayout(vBox); } @@ -34,23 +43,4 @@ namespace qt // @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()), this, SLOT(OnButtonClick())); - hBox->addWidget(button); - } - } } |