summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPino Toscano <pino@kde.org>2016-11-20 10:54:08 (GMT)
committerPino Toscano <pino@kde.org>2016-11-20 10:54:08 (GMT)
commit327e77eb6c2f2bc1bbc08b48ae19c98434d4115c (patch)
tree613bd449812a813c473bdf362ef8f03279fc0fe1
parent30bd79a4fdc51089a037f067c3890e42bb769e32 (diff)
use QDialogButtonBox
... instead of manually adding a layout with OK and Cancel buttons
-rw-r--r--libkcddb/cdinfodialog.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/libkcddb/cdinfodialog.cpp b/libkcddb/cdinfodialog.cpp
index 63d1367..ded87f1 100644
--- a/libkcddb/cdinfodialog.cpp
+++ b/libkcddb/cdinfodialog.cpp
@@ -32,6 +32,7 @@
#include <QtCore/QTime>
#include <QtGui/QStandardItemModel>
#include <QtWidgets/QVBoxLayout>
+#include <QtWidgets/QDialogButtonBox>
using KCDDB::TrackInfo;
@@ -91,14 +92,10 @@ class CDInfoDialog::Private
connect(d->ui->m_changeEncoding,SIGNAL(clicked()),SLOT(slotChangeEncoding()));
- QHBoxLayout *hbox = new QHBoxLayout;
- layout->addLayout(hbox);
- QPushButton *ok = new QPushButton(i18n("Ok"));
- connect(ok, SIGNAL(clicked()), SLOT(accept()));
- QPushButton *cancel = new QPushButton(i18n("Cancel"));
- connect(cancel, SIGNAL(clicked()), SLOT(close()));
- hbox->addWidget(ok);
- hbox->addWidget(cancel);
+ QDialogButtonBox *bbox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
+ layout->addWidget(bbox);
+ connect(bbox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(accept()));
+ connect(bbox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(close()));
}
void CDInfoDialog::slotTrackSelected( const QModelIndex &index )