Qt4 build fixed

This commit is contained in:
Arin Alexander 2017-04-19 02:04:14 +04:00
parent d0cf6f4961
commit 1700576394
6 changed files with 60 additions and 25 deletions

View File

@ -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);

View File

@ -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

View File

@ -3,9 +3,6 @@
#include <QPluginLoader>
#include <QDesignerComponents>
#include <QDesignerIntegration>
#include <abstractobjectinspector.h>
#include <QDesignerFormEditorInterface>
#include <QDesignerFormWindowInterface>
#include <QDesignerFormWindowManagerInterface>
@ -19,10 +16,17 @@
#include <QAction>
#include <QDebug>
#include <QVBoxLayout>
#include "pluginmanager_p.h"
//#include <QExtensionManager>
#if HAVE_QT5
#include <QDesignerIntegration>
#endif
#if HAVE_QT4
#include "qdesigner_integration_p.h"
#include <QtDesigner/QDesignerIntegrationInterface>
#endif
#include "pluginmanager_p.h"
#include "widgethost.h"
#include <abstractobjectinspector.h>
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<DialogDesigner*>(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);
}
}
}

View File

@ -4,6 +4,7 @@
#include <QObject>
#include <QVector>
#include <QToolBar>
#include <QActionGroup>
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:

View File

@ -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())

View File

@ -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){