Commit 2cd5b448 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

NewDialog: Simplify code a bit



Convert some connects to Qt5-style while at it.

Change-Id: Ib5d8af8ccded1005302ad2da3c185c73a8992bd6
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent 093a54cb
...@@ -224,20 +224,15 @@ NewDialog::NewDialog(QWidget *parent) : ...@@ -224,20 +224,15 @@ NewDialog::NewDialog(QWidget *parent) :
m_ui->templatesView->setModel(m_filterProxyModel); m_ui->templatesView->setModel(m_filterProxyModel);
m_ui->templatesView->setIconSize(QSize(ICON_SIZE, ICON_SIZE)); m_ui->templatesView->setIconSize(QSize(ICON_SIZE, ICON_SIZE));
connect(m_ui->templateCategoryView->selectionModel(), connect(m_ui->templateCategoryView->selectionModel(), &QItemSelectionModel::currentChanged,
SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, &NewDialog::currentCategoryChanged);
this, SLOT(currentCategoryChanged(QModelIndex)));
connect(m_ui->templatesView->selectionModel(), connect(m_ui->templatesView->selectionModel(), &QItemSelectionModel::currentChanged,
SIGNAL(currentChanged(QModelIndex,QModelIndex)), this, &NewDialog::currentItemChanged);
this, SLOT(currentItemChanged(QModelIndex)));
connect(m_ui->templatesView, connect(m_ui->templatesView, &QListView::doubleClicked, this, &NewDialog::accept);
SIGNAL(doubleClicked(QModelIndex)), connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &NewDialog::accept);
this, SLOT(okButtonClicked())); connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &NewDialog::reject);
connect(m_okButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
connect(m_ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setSelectedPlatform(QString))); connect(m_ui->comboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(setSelectedPlatform(QString)));
} }
...@@ -453,18 +448,16 @@ void NewDialog::saveState() ...@@ -453,18 +448,16 @@ void NewDialog::saveState()
m_lastCategory = currentItem->data(Qt::UserRole).toString(); m_lastCategory = currentItem->data(Qt::UserRole).toString();
} }
void NewDialog::okButtonClicked() void NewDialog::accept()
{ {
if (m_ui->templatesView->currentIndex().isValid()) { saveState();
hide(); QDialog::accept();
saveState();
if (m_ui->templatesView->currentIndex().isValid()) {
IWizardFactory *wizard = currentWizardFactory(); IWizardFactory *wizard = currentWizardFactory();
QTC_ASSERT(wizard, accept(); return); QTC_ASSERT(wizard, accept(); return);
QString path = wizard->runPath(m_defaultLocation); QString path = wizard->runPath(m_defaultLocation);
wizard->runWizard(path, ICore::dialogParent(), selectedPlatform(), m_extraVariables); wizard->runWizard(path, ICore::dialogParent(), selectedPlatform(), m_extraVariables);
close();
} }
} }
......
...@@ -75,7 +75,7 @@ protected: ...@@ -75,7 +75,7 @@ protected:
private slots: private slots:
void currentCategoryChanged(const QModelIndex &); void currentCategoryChanged(const QModelIndex &);
void currentItemChanged(const QModelIndex &); void currentItemChanged(const QModelIndex &);
void okButtonClicked(); void accept();
void reject(); void reject();
void updateOkButton(); void updateOkButton();
void setSelectedPlatform(const QString &platform); void setSelectedPlatform(const QString &platform);
......
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