add buttons in exporttemplatedlg

work/spdx
Michail Vourlakos 4 years ago
parent 222caf28da
commit dd2d125c70

@ -38,6 +38,9 @@ ExportTemplateDialog::ExportTemplateDialog(QWidget *parent, const QString &layou
//! first we need to setup the ui
m_ui->setupUi(this);
initExtractButton(i18n("Export your selected layout as template"));
initButtons();
//! we must create handlers after creating/adjusting the ui
m_handler = new Handler::ExportTemplateHandler(this, layoutName, layoutId);
}
@ -50,6 +53,9 @@ ExportTemplateDialog::ExportTemplateDialog(Latte::View *view)
//! first we need to setup the ui
m_ui->setupUi(this);
initExtractButton(i18n("Export your selected view as template"));
initButtons();
//! we must create handlers after creating/adjusting the ui
m_handler = new Handler::ExportTemplateHandler(this, view);
}
@ -63,9 +69,30 @@ Ui::ExportTemplateDialog *ExportTemplateDialog::ui() const
return m_ui;
}
void ExportTemplateDialog::initButtons()
{
connect(m_ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked,
this, &ExportTemplateDialog::onCancel);
connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked,
this, &ExportTemplateDialog::onCancel);
}
void ExportTemplateDialog::initExtractButton(const QString &tooltip)
{
QPushButton *extractBtn = new QPushButton(this);
extractBtn->setText(i18nc("export template", "Export"));
extractBtn->setIcon(QIcon::fromTheme("document-export"));
extractBtn->setToolTip(tooltip);
m_ui->buttonBox->addButton(extractBtn, QDialogButtonBox::AcceptRole);
connect(extractBtn, &QPushButton::clicked, this, &ExportTemplateDialog::onCancel);
}
void ExportTemplateDialog::accept()
{
qDebug() << Q_FUNC_INFO;
//close();
}
void ExportTemplateDialog::onCancel()
@ -74,6 +101,12 @@ void ExportTemplateDialog::onCancel()
close();
}
void ExportTemplateDialog::onReset()
{
qDebug() << Q_FUNC_INFO;
close();
}
}
}
}

@ -67,6 +67,10 @@ protected:
private slots:
void onCancel();
void onReset();
void initButtons();
void initExtractButton(const QString &tooltip);
private:
bool m_isExportingLayout{false};

@ -116,7 +116,7 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
<height>15</height>
</size>
</property>
</spacer>

Loading…
Cancel
Save