0
0
mirror of https://github.com/fralx/LimeReport.git synced 2024-12-25 00:54:39 +03:00

Merge branch 'develop' into feature/CH_Private_To_Public

This commit is contained in:
Arin Alexander 2017-04-19 01:58:22 +03:00
commit 0f6f2f1536
8 changed files with 59 additions and 25 deletions

View File

@ -94,7 +94,7 @@ signals:
public slots: public slots:
virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling); virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling);
// Additional signals of designer property editor // 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 resetProperty(const QString &name);
virtual void addDynamicProperty(const QString &name, const QVariant &value); virtual void addDynamicProperty(const QString &name, const QVariant &value);
virtual void removeDynamicProperty(const QString &name); virtual void removeDynamicProperty(const QString &name);

View File

@ -11,7 +11,14 @@ lessThan(QT_MAJOR_VERSION, 5){
DEFINES += HAVE_QTDESIGNER_INTEGRATION DEFINES += HAVE_QTDESIGNER_INTEGRATION
} }
} }
QT += designer designercomponents-private
greaterThan(QT_MAJOR_VERSION, 4) {
QT *= designer designercomponents-private
} else {
CONFIG *= designer
qtAddLibrary( QtDesignerComponents )
}
SOURCES += $$PWD/lrdialogdesigner.cpp SOURCES += $$PWD/lrdialogdesigner.cpp
HEADERS += $$PWD/lrdialogdesigner.h HEADERS += $$PWD/lrdialogdesigner.h

View File

@ -3,9 +3,6 @@
#include <QPluginLoader> #include <QPluginLoader>
#include <QDesignerComponents> #include <QDesignerComponents>
#include <QDesignerIntegration>
#include <abstractobjectinspector.h>
#include <QDesignerFormEditorInterface> #include <QDesignerFormEditorInterface>
#include <QDesignerFormWindowInterface> #include <QDesignerFormWindowInterface>
#include <QDesignerFormWindowManagerInterface> #include <QDesignerFormWindowManagerInterface>
@ -19,10 +16,17 @@
#include <QAction> #include <QAction>
#include <QDebug> #include <QDebug>
#include <QVBoxLayout> #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 "widgethost.h"
#include <abstractobjectinspector.h>
namespace LimeReport{ namespace LimeReport{
@ -98,7 +102,12 @@ DialogDesignerManager::DialogDesignerManager(QObject *parent) : QObject(parent)
m_designerToolWindows.append(m_actionEditor); m_designerToolWindows.append(m_actionEditor);
connect(m_actionEditor, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*)) ); 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); m_designerIntegration = new QDesignerIntegration(m_formEditor,this);
#endif
m_formEditor->setIntegration(m_designerIntegration); m_formEditor->setIntegration(m_designerIntegration);
} }
@ -151,7 +160,7 @@ QWidget *DialogDesignerManager::createFormEditor(const QString &content)
DialogDesigner* dialogDesigner = new DialogDesigner(wnd, m_formEditor); 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(dialogNameChanged(QString,QString)), this, SIGNAL(dialogNameChanged(QString,QString)));
connect(dialogDesigner, SIGNAL(destroyed(QObject*)), this, SLOT(slotObjectDestroyed(QObject*))); 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) QString DialogDesignerManager::iconPathByName(const QString &name)
{ {
if (name.compare("__qt_edit_signals_slots_action") == 0) if (name.compare("__qt_edit_signals_slots_action") == 0)
@ -276,8 +277,7 @@ DialogDesigner::DialogDesigner(QDesignerFormWindowInterface* wnd, QDesignerFormE
:QWidget(parent, flags), m_formEditor(formEditor) :QWidget(parent, flags), m_formEditor(formEditor)
{ {
m_dialogName = wnd->mainContainer()->objectName(); m_dialogName = wnd->mainContainer()->objectName();
connect(wnd, SIGNAL(changed()), this, SIGNAL(dialogChanged())); connect(wnd, SIGNAL(changed()), this, SLOT(slotDialogChanged()));
connect(wnd->mainContainer(), SIGNAL(objectNameChanged(QString)), this, SLOT(slotMainContainerNameChanged(QString)));
m_designerHolder = new SharedTools::WidgetHost(this,wnd); m_designerHolder = new SharedTools::WidgetHost(this,wnd);
m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain ); m_designerHolder->setFrameStyle( QFrame::NoFrame | QFrame::Plain );
@ -308,7 +308,7 @@ bool DialogDesigner::isChanged()
void DialogDesigner::setChanged(bool value) void DialogDesigner::setChanged(bool value)
{ {
m_designerHolder->formWindow()->setDirty(false); m_designerHolder->formWindow()->setDirty(value);
} }
QByteArray DialogDesigner::dialogContent() 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 <QObject>
#include <QVector> #include <QVector>
#include <QToolBar> #include <QToolBar>
#include <QActionGroup>
class QDesignerFormEditorInterface; class QDesignerFormEditorInterface;
class QDesignerFormWindowInterface; class QDesignerFormWindowInterface;
@ -23,7 +24,7 @@ namespace LimeReport{
class DialogDesigner : public QWidget{ class DialogDesigner : public QWidget{
Q_OBJECT Q_OBJECT
public: 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(); ~DialogDesigner();
QString dialogName() const; QString dialogName() const;
void setDialogName(const QString &dialogName); void setDialogName(const QString &dialogName);
@ -34,11 +35,11 @@ public slots:
void undo(); void undo();
void redo(); void redo();
signals: signals:
void dialogChanged(); void dialogChanged(QString dialogName);
void dialogNameChanged(QString oldName, QString newName); void dialogNameChanged(QString oldName, QString newName);
private slots: private slots:
void slotMainContainerNameChanged(QString newName); void slotMainContainerNameChanged(QString newName);
void slotDialogChanged();
private: private:
QString m_dialogName; QString m_dialogName;
SharedTools::WidgetHost* m_designerHolder; SharedTools::WidgetHost* m_designerHolder;
@ -69,7 +70,6 @@ private slots:
void slotObjectDestroyed(QObject* object); void slotObjectDestroyed(QObject* object);
void slotEditWidgets(); void slotEditWidgets();
void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow); void slotActiveFormWindowChanged(QDesignerFormWindowInterface *formWindow);
void slotDialogChanged();
private: private:
QString iconPathByName(const QString& name); QString iconPathByName(const QString& name);
private: private:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 467 B

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 466 B

After

Width:  |  Height:  |  Size: 484 B

View File

@ -164,8 +164,12 @@ void PreviewReportWidget::print()
QPrinter printer(QPrinter::HighResolution); QPrinter printer(QPrinter::HighResolution);
if (!pi.defaultPrinter().isNull()) if (!pi.defaultPrinter().isNull())
#ifdef HAVE_QT4
printer.setPrinterName(pi.defaultPrinter().printerName());
#endif
#ifdef HAVE_QT5
printer.setPrinterName(pi.defaultPrinterName()); printer.setPrinterName(pi.defaultPrinterName());
#endif
QPrintDialog dialog(&printer,QApplication::activeWindow()); QPrintDialog dialog(&printer,QApplication::activeWindow());
if (dialog.exec()==QDialog::Accepted){ if (dialog.exec()==QDialog::Accepted){
if (!d_ptr->m_reportPages.isEmpty()) if (!d_ptr->m_reportPages.isEmpty())

View File

@ -274,7 +274,12 @@ bool ReportEnginePrivate::printReport(QPrinter* printer)
if (!printer&&!m_printerSelected){ if (!printer&&!m_printerSelected){
QPrinterInfo pi; QPrinterInfo pi;
if (!pi.defaultPrinter().isNull()) if (!pi.defaultPrinter().isNull())
#ifdef HAVE_QT4
m_printer.data()->setPrinterName(pi.defaultPrinter().printerName());
#endif
#ifdef HAVE_QT5
m_printer.data()->setPrinterName(pi.defaultPrinterName()); m_printer.data()->setPrinterName(pi.defaultPrinterName());
#endif
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
m_printerSelected = dialog.exec()!=QDialog::Rejected; m_printerSelected = dialog.exec()!=QDialog::Rejected;
} }
@ -301,7 +306,12 @@ bool ReportEnginePrivate::printPages(ReportPages pages, QPrinter *printer, Print
if (!printer&&!m_printerSelected){ if (!printer&&!m_printerSelected){
QPrinterInfo pi; QPrinterInfo pi;
if (!pi.defaultPrinter().isNull()) if (!pi.defaultPrinter().isNull())
#ifdef HAVE_QT4
m_printer.data()->setPrinterName(pi.defaultPrinter().printerName());
#endif
#ifdef HAVE_QT5
m_printer.data()->setPrinterName(pi.defaultPrinterName()); m_printer.data()->setPrinterName(pi.defaultPrinterName());
#endif
QPrintDialog dialog(m_printer.data(),QApplication::activeWindow()); QPrintDialog dialog(m_printer.data(),QApplication::activeWindow());
m_printerSelected = dialog.exec()!=QDialog::Rejected; m_printerSelected = dialog.exec()!=QDialog::Rejected;
if (m_printerSelected){ if (m_printerSelected){