Revert to old close behaviour
Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
parent
1a76e04925
commit
2c869c7a02
2 changed files with 11 additions and 18 deletions
|
@ -14,6 +14,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "PageDialog.h"
|
#include "PageDialog.h"
|
||||||
|
#include <qevent.h>
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
@ -53,22 +54,16 @@ PageDialog::PageDialog(BasePageProvider* pageProvider, QString defaultId, QWidge
|
||||||
connect(buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &PageDialog::reject);
|
connect(buttons->button(QDialogButtonBox::Cancel), &QPushButton::clicked, this, &PageDialog::reject);
|
||||||
connect(buttons->button(QDialogButtonBox::Help), &QPushButton::clicked, m_container, &PageContainer::help);
|
connect(buttons->button(QDialogButtonBox::Help), &QPushButton::clicked, m_container, &PageContainer::help);
|
||||||
|
|
||||||
connect(this, &QDialog::accepted, this, &PageDialog::onAccepted);
|
|
||||||
connect(this, &QDialog::rejected, this, &PageDialog::storeGeometry);
|
|
||||||
|
|
||||||
restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("PagedGeometry").toByteArray()));
|
restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get("PagedGeometry").toByteArray()));
|
||||||
}
|
}
|
||||||
void PageDialog::onAccepted()
|
|
||||||
|
void PageDialog::closeEvent([[maybe_unused]] QCloseEvent* event)
|
||||||
{
|
{
|
||||||
qDebug() << "Paged dialog accepted";
|
qDebug() << "Paged dialog close requested";
|
||||||
if (m_container->prepareToClose()) {
|
if (m_container->prepareToClose()) {
|
||||||
qDebug() << "Paged dialog close approved";
|
qDebug() << "Paged dialog close approved";
|
||||||
emit applied();
|
APPLICATION->settings()->set("PagedGeometry", saveGeometry().toBase64());
|
||||||
|
qDebug() << "Paged dialog geometry saved";
|
||||||
|
QDialog::closeEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageDialog::storeGeometry()
|
|
||||||
{
|
|
||||||
APPLICATION->settings()->set("PagedGeometry", saveGeometry().toBase64());
|
|
||||||
qDebug() << "Paged dialog geometry saved";
|
|
||||||
}
|
|
||||||
|
|
|
@ -25,13 +25,11 @@ class PageDialog : public QDialog {
|
||||||
explicit PageDialog(BasePageProvider* pageProvider, QString defaultId = QString(), QWidget* parent = 0);
|
explicit PageDialog(BasePageProvider* pageProvider, QString defaultId = QString(), QWidget* parent = 0);
|
||||||
virtual ~PageDialog() {}
|
virtual ~PageDialog() {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void applied();
|
void applied();
|
||||||
|
|
||||||
|
private:
|
||||||
private slots:
|
void closeEvent(QCloseEvent* event) override;
|
||||||
void onAccepted();
|
|
||||||
void storeGeometry();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PageContainer* m_container;
|
PageContainer* m_container;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue