From 170057639447a001e32dd059808b3acc9a1be853 Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Wed, 19 Apr 2017 02:04:14 +0400 Subject: [PATCH] Qt4 build fixed --- .../designer/qdesigner_integration_p.h | 2 +- limereport/dialogdesigner/dialogdesigner.pri | 10 +++- .../dialogdesigner/lrdialogdesigner.cpp | 47 ++++++++++++------- limereport/dialogdesigner/lrdialogdesigner.h | 8 ++-- limereport/lrpreviewreportwidget.cpp | 8 +++- limereport/lrreportengine.cpp | 10 ++++ 6 files changed, 60 insertions(+), 25 deletions(-) diff --git a/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h b/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h index f59c001..6c76d10 100644 --- a/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h +++ b/limereport/dialogdesigner/3rdparty/designer/qdesigner_integration_p.h @@ -94,7 +94,7 @@ signals: public slots: virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling); // Additional signals of designer property editor - virtual void updatePropertyComment(const QString &name, const QString &value); +// virtual void updatePropertyComment(const QString &name, const QString &value); virtual void resetProperty(const QString &name); virtual void addDynamicProperty(const QString &name, const QVariant &value); virtual void removeDynamicProperty(const QString &name); diff --git a/limereport/dialogdesigner/dialogdesigner.pri b/limereport/dialogdesigner/dialogdesigner.pri index df76e68..9bd17dd 100644 --- a/limereport/dialogdesigner/dialogdesigner.pri +++ b/limereport/dialogdesigner/dialogdesigner.pri @@ -11,7 +11,15 @@ lessThan(QT_MAJOR_VERSION, 5){ DEFINES += HAVE_QTDESIGNER_INTEGRATION } } -QT += designer designercomponents-private + +greaterThan(QT_MAJOR_VERSION, 4) { + QT *= designer designercomponents-private + +} else { + CONFIG *= designer + qtAddLibrary( QtDesignerComponents ) +} +#QT += designer designercomponents-private SOURCES += $$PWD/lrdialogdesigner.cpp HEADERS += $$PWD/lrdialogdesigner.h diff --git a/limereport/dialogdesigner/lrdialogdesigner.cpp b/limereport/dialogdesigner/lrdialogdesigner.cpp index 6a33752..82a08d0 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.cpp +++ b/limereport/dialogdesigner/lrdialogdesigner.cpp @@ -3,9 +3,6 @@ #include #include -#include -#include - #include #include #include @@ -19,10 +16,17 @@ #include #include #include -#include "pluginmanager_p.h" -//#include +#if HAVE_QT5 +#include +#endif +#if HAVE_QT4 +#include "qdesigner_integration_p.h" +#include +#endif +#include "pluginmanager_p.h" #include "widgethost.h" +#include namespace LimeReport{ @@ -98,7 +102,12 @@ DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent) m_designerToolWindows.append(m_actionEditor); connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); +#ifdef HAVE_QT4 + m_designerIntegration = new qdesigner_internal::QDesignerIntegration(m_formEditor,this); +#endif +#ifdef HAVE_QT5 m_designerIntegration = new QDesignerIntegration(m_formEditor,this); +#endif m_formEditor->setIntegration(m_designerIntegration); } @@ -151,7 +160,7 @@ QWidget *DialogDesignerManager::createFormEditor(const QString &content) DialogDesigner* dialogDesigner = new DialogDesigner(wnd, m_formEditor); - connect(dialogDesigner, SIGNAL(dialogChanged()), this, SLOT(slotDialogChanged())); + connect(dialogDesigner, SIGNAL(dialogChanged(QString)), this, SIGNAL(dialogChanged(QString))); connect(dialogDesigner, SIGNAL(dialogNameChanged(QString,QString)), this, SIGNAL(dialogNameChanged(QString,QString))); connect(dialogDesigner, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*))); @@ -253,14 +262,6 @@ void DialogDesignerManager::slotActiveFormWindowChanged(QDesignerFormWindowInter } } -void DialogDesignerManager::slotDialogChanged() -{ - DialogDesigner* dialogDesigner = dynamic_cast(sender()); - if (dialogDesigner){ - emit dialogChanged(dialogDesigner->dialogName()); - } -} - QString DialogDesignerManager::iconPathByName(const QString &name) { if (name.compare("__qt_edit_signals_slots_action") == 0) @@ -276,8 +277,7 @@ DialogDesigner::DialogDesigner(QDesignerFormWindowInterface* wnd, QDesignerFormE :QWidget(parent, flags), m_formEditor(formEditor) { m_dialogName = wnd->mainContainer()->objectName(); - connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged())); - connect(wnd->mainContainer(), SIGNAL(objectNameChanged(QString)), this, SLOT(slotMainContainerNameChanged(QString))); + connect(wnd, SIGNAL(changed()), this, SLOT(slotDialogChanged())); m_designerHolder = new SharedTools::WidgetHost(this,wnd); m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); @@ -308,7 +308,7 @@ bool DialogDesigner::isChanged() void DialogDesigner::setChanged(bool value) { - m_designerHolder->formWindow()->setDirty(false); + m_designerHolder->formWindow()->setDirty(value); } QByteArray DialogDesigner::dialogContent() @@ -342,4 +342,17 @@ void DialogDesigner::slotMainContainerNameChanged(QString newName) } } +void DialogDesigner::slotDialogChanged() +{ + Q_ASSERT(m_designerHolder != NULL); + if (m_designerHolder && m_designerHolder->formWindow()){ + if ( m_designerHolder->formWindow()->mainContainer()->objectName().compare(m_dialogName) !=0 ){ + emit dialogNameChanged(m_dialogName, m_designerHolder->formWindow()->mainContainer()->objectName()); + m_dialogName = m_designerHolder->formWindow()->mainContainer()->objectName(); + } + emit dialogChanged(m_dialogName); + m_designerHolder->formWindow()->setDirty(false); + } +} + } diff --git a/limereport/dialogdesigner/lrdialogdesigner.h b/limereport/dialogdesigner/lrdialogdesigner.h index 8a0bfbe..a5c33bc 100644 --- a/limereport/dialogdesigner/lrdialogdesigner.h +++ b/limereport/dialogdesigner/lrdialogdesigner.h @@ -4,6 +4,7 @@ #include #include #include +#include class QDesignerFormEditorInterface; class QDesignerFormWindowInterface; @@ -23,7 +24,7 @@ namespace LimeReport{ class DialogDesigner : public QWidget{ Q_OBJECT public: - DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = Q_NULLPTR, Qt::WindowFlags flags = Qt::WindowFlags()); + DialogDesigner(QDesignerFormWindowInterface *wnd, QDesignerFormEditorInterface* formEditor, QWidget *parent = NULL, Qt::WindowFlags flags = Qt::WindowFlags()); ~DialogDesigner(); QString dialogName() const; void setDialogName(const QString &dialogName); @@ -34,11 +35,11 @@ public slots: void undo(); void redo(); signals: - void dialogChanged(); + void dialogChanged(QString dialogName); void dialogNameChanged(QString oldName, QString newName); - private slots: void slotMainContainerNameChanged(QString newName); + void slotDialogChanged(); private: QString m_dialogName; SharedTools::WidgetHost* m_designerHolder; @@ -69,7 +70,6 @@ private slots: void slotObjectDestroyed(QObject* object); void slotEditWidgets(); void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow); - void slotDialogChanged(); private: QString iconPathByName(const QString& name); private: diff --git a/limereport/lrpreviewreportwidget.cpp b/limereport/lrpreviewreportwidget.cpp index dcddb74..fdf2e3b 100644 --- a/limereport/lrpreviewreportwidget.cpp +++ b/limereport/lrpreviewreportwidget.cpp @@ -163,8 +163,12 @@ void PreviewReportWidget::print() QPrinter printer(QPrinter::HighResolution); if (!pi.defaultPrinter().isNull()) - printer.setPrinterName(pi.defaultPrinterName()); - +#ifdef HAVE_QT4 + printer.setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 + printer.setPrinterName(pi.defaultPrinterName()); +#endif QPrintDialog dialog(&printer,QApplication::activeWindow()); if (dialog.exec()==QDialog::Accepted){ if (!d_ptr->m_reportPages.isEmpty()) diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 6f9c6e0..10ea8bb 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -274,7 +274,12 @@ bool ReportEnginePrivate::printReport(QPrinter* printer) if (!printer&&!m_printerSelected){ QPrinterInfo pi; if (!pi.defaultPrinter().isNull()) +#ifdef HAVE_QT4 + m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 m_printer.data()->setPrinterName(pi.defaultPrinterName()); +#endif QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; } @@ -301,7 +306,12 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, Print if (!printer&&!m_printerSelected){ QPrinterInfo pi; if (!pi.defaultPrinter().isNull()) +#ifdef HAVE_QT4 + m_printer.data()->setPrinterName(pi.defaultPrinter().printerName()); +#endif +#ifdef HAVE_QT5 m_printer.data()->setPrinterName(pi.defaultPrinterName()); +#endif QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); m_printerSelected = dialog.exec()!=QDialog::Rejected; if (m_printerSelected){