mirror of
https://github.com/python-LimeReport/LimeReport.git
synced 2025-01-11 12:28:09 +03:00
Fix #30 Destroying a report engine does not destroy all it's windows and lead to crash
This commit is contained in:
parent
2e4ee6ca05
commit
fab352c81c
@ -67,6 +67,9 @@ ReportEnginePrivate::ReportEnginePrivate(QObject *parent) :
|
|||||||
|
|
||||||
ReportEnginePrivate::~ReportEnginePrivate()
|
ReportEnginePrivate::~ReportEnginePrivate()
|
||||||
{
|
{
|
||||||
|
if (m_designerWindow) {
|
||||||
|
m_designerWindow->close();
|
||||||
|
}
|
||||||
if (m_activePreview){
|
if (m_activePreview){
|
||||||
m_activePreview->close();
|
m_activePreview->close();
|
||||||
}
|
}
|
||||||
@ -392,20 +395,28 @@ void ReportEnginePrivate::designReport()
|
|||||||
w->setAttribute(Qt::WA_DeleteOnClose,true);
|
w->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||||
w->setWindowIcon(QIcon(":report/images/logo32"));
|
w->setWindowIcon(QIcon(":report/images/logo32"));
|
||||||
w->setShowProgressDialog(m_showProgressDialog);
|
w->setShowProgressDialog(m_showProgressDialog);
|
||||||
|
|
||||||
|
if (!m_designerWindow) {
|
||||||
|
m_designerWindow = new LimeReport::ReportDesignWindow(this,QApplication::activeWindow(),settings());
|
||||||
|
m_designerWindow->setAttribute(Qt::WA_DeleteOnClose,true);
|
||||||
|
m_designerWindow->setWindowIcon(QIcon(":report/images/logo32"));
|
||||||
|
m_designerWindow->setShowProgressDialog(m_showProgressDialog);
|
||||||
|
}
|
||||||
|
|
||||||
#if defined(Q_OS_MAC)
|
#if defined(Q_OS_MAC)
|
||||||
//w->showModal();
|
//m_designerWindow->showModal();
|
||||||
#elif defined(Q_OS_UNIX)
|
#elif defined(Q_OS_UNIX)
|
||||||
//w->showModal();
|
//m_designerWindow->showModal();
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
//w->setWindowFlags(Qt::Window|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint|Qt::WindowMinimizeButtonHint);
|
//m_designerWindow->setWindowFlags(Qt::Window|Qt::WindowMaximizeButtonHint|Qt::WindowCloseButtonHint|Qt::WindowMinimizeButtonHint);
|
||||||
w->setWindowModality(Qt::ApplicationModal);
|
m_designerWindow->setWindowModality(Qt::ApplicationModal);
|
||||||
//w->showModal();
|
//m_designerWindow->showModal();
|
||||||
#endif
|
#endif
|
||||||
if (QApplication::activeWindow()==0){
|
if (QApplication::activeWindow()==0){
|
||||||
w->show();
|
m_designerWindow->show();;
|
||||||
} else {
|
} else {
|
||||||
w->showModal();
|
m_designerWindow->showModal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ namespace LimeReport{
|
|||||||
|
|
||||||
class PageDesignIntf;
|
class PageDesignIntf;
|
||||||
class PrintRange;
|
class PrintRange;
|
||||||
|
class ReportDesignWindow;
|
||||||
|
|
||||||
//TODO: Add on render callback
|
//TODO: Add on render callback
|
||||||
|
|
||||||
@ -156,6 +157,7 @@ private:
|
|||||||
QMainWindow* m_activePreview;
|
QMainWindow* m_activePreview;
|
||||||
QIcon m_previewWindowIcon;
|
QIcon m_previewWindowIcon;
|
||||||
QString m_previewWindowTitle;
|
QString m_previewWindowTitle;
|
||||||
|
QPointer<ReportDesignWindow> m_designerWindow;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user