Commit 9f02ca85 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port to QDialog

parent 9bd8265f
......@@ -9,12 +9,27 @@
#include "newgamedialog.h"
#include <QDebug>
#include <KConfigGroup>
#include <QDialogButtonBox>
#include <QPushButton>
#include <QVBoxLayout>
NewGameDialog::NewGameDialog(QWidget* parent) : KDialog(parent)
NewGameDialog::NewGameDialog(QWidget* parent) : QDialog(parent)
{
setupUi(mainWidget());
setButtons(Cancel|Ok);
setCaption(i18n("New Game"));
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
setupUi(mainWidget);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
//PORTING SCRIPT: WARNING mainLayout->addWidget(buttonBox) must be last item in layout. Please move it.
mainLayout->addWidget(buttonBox);
setWindowTitle(i18n("New Game"));
connect(spinNumOfPlayers, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &NewGameDialog::adjustEnabledUsers);
adjustEnabledUsers(spinNumOfPlayers->value());
......
......@@ -12,9 +12,9 @@
#include "ui_newgamewidget.h"
#include <kdialog.h>
#include <QDialog>
class NewGameDialog : public KDialog, public Ui::NewGameWidget
class NewGameDialog : public QDialog, public Ui::NewGameWidget
{
Q_OBJECT
public:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment