diff --git a/common.pri b/common.pri index fede1a2..47e0f98 100644 --- a/common.pri +++ b/common.pri @@ -128,7 +128,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 27 +LIMEREPORT_VERSION_RELEASE = 28 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/designer/main.cpp b/designer/main.cpp index 8d06579..57a32c1 100644 --- a/designer/main.cpp +++ b/designer/main.cpp @@ -47,6 +47,7 @@ int main(int argc, char *argv[]) QObject::connect(&report, SIGNAL(currentDefaultDesignerLanguageChanged(QLocale::Language)), &manager, SLOT(currentDefaultLanguageChanged(QLocale::Language))); + report.setShowDesignerModal(false); report.designReport(); return a.exec(); } diff --git a/include/lrreportengine.h b/include/lrreportengine.h index 8ef7ff0..6509302 100644 --- a/include/lrreportengine.h +++ b/include/lrreportengine.h @@ -208,6 +208,9 @@ public: bool showPreparedPages(PreviewHints hints = PreviewBarsUserSetting); bool prepareReportPages(); bool printPreparedPages(); + bool showDesignerModal() const; + void setShowDesignerModal(bool showDesignerModal); + signals: void cleared(); void renderStarted(); @@ -241,6 +244,7 @@ protected: private: Q_DECLARE_PRIVATE(ReportEngine) static QSettings* m_settings; + bool m_showDesignerModal; }; } // namespace LimeReport diff --git a/limereport/items/lrchartitem.cpp b/limereport/items/lrchartitem.cpp index df86704..abeb2e4 100644 --- a/limereport/items/lrchartitem.cpp +++ b/limereport/items/lrchartitem.cpp @@ -800,22 +800,36 @@ void VerticalBarChart::paintSerialLines(QPainter* painter, QRectF barsRect) painter->restore(); } - - void VerticalBarChart::paintLabels(QPainter *painter, QRectF labelsRect) { painter->save(); qreal hStep = (labelsRect.width() / valuesCount()); - - if (!m_chartItem->labels().isEmpty()){ - painter->rotate(270); - painter->translate(-(labelsRect.top()+labelsRect.height()),labelsRect.left()); - foreach (QString label, m_chartItem->labels()) { - painter->drawText(QRectF(QPoint(0,0), - QSize(labelsRect.height()-4,hStep)),Qt::AlignVCenter|Qt::AlignRight,label); - painter->translate(0,hStep); + bool rotateLabels = false; + QFontMetrics fm = painter->fontMetrics(); + foreach(QString label, m_chartItem->labels()){ + if (fm.width(label) > hStep){ + rotateLabels = true; + break; + } + } + if (!m_chartItem->labels().isEmpty()){ + if (rotateLabels){ + painter->rotate(270); + painter->translate( -(labelsRect.top()+labelsRect.height()), labelsRect.left() ); + foreach (QString label, m_chartItem->labels()) { + painter->drawText(QRectF(QPoint(0,0), + QSize(labelsRect.height()-4, hStep)), Qt::AlignVCenter | Qt::AlignRight, label); + painter->translate(0,hStep); + } + painter->rotate(-270); + } else { + painter->translate( labelsRect.left(), labelsRect.top() ); + foreach (QString label, m_chartItem->labels()) { + painter->drawText(QRectF(QPoint(0, 4), + QSize(hStep, labelsRect.height()-4)), Qt::AlignHCenter | Qt::AlignTop, label); + painter->translate(hStep, 0); + } } - painter->rotate(-270); } painter->restore(); } diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 8d25064..81657c5 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -738,7 +738,7 @@ QGraphicsScene* ReportEngine::createPreviewScene(QObject* parent){ return d->createPreviewScene(parent); } -void ReportEnginePrivate::designReport() +void ReportEnginePrivate::designReport(bool showModal) { ReportDesignWindowInterface* designerWindow = getDesignerWindow(); if (designerWindow){ @@ -747,7 +747,7 @@ void ReportEnginePrivate::designReport() #ifdef Q_OS_WIN designerWindow->setWindowModality(Qt::ApplicationModal); #endif - if (QApplication::activeWindow()==0){ + if (!showModal){ designerWindow->show();; } else { designerWindow->showModal(); @@ -1373,7 +1373,7 @@ QString ReportEnginePrivate::lastError() } ReportEngine::ReportEngine(QObject *parent) - : QObject(parent), d_ptr(new ReportEnginePrivate()) + : QObject(parent), d_ptr(new ReportEnginePrivate()), m_showDesignerModal(true) { Q_D(ReportEngine); d->q_ptr=this; @@ -1469,7 +1469,7 @@ void ReportEngine::designReport() Q_D(ReportEngine); if (m_settings) d->setSettings(m_settings); - d->designReport(); + d->designReport(showDesignerModal()); } ReportDesignWindowInterface* ReportEngine::getDesignerWindow() @@ -1760,7 +1760,7 @@ void ReportEngine::cancelPrinting() } ReportEngine::ReportEngine(ReportEnginePrivate &dd, QObject *parent) - :QObject(parent),d_ptr(&dd) + :QObject(parent), d_ptr(&dd), m_showDesignerModal(true) { Q_D(ReportEngine); d->q_ptr=this; @@ -1770,6 +1770,16 @@ ReportEngine::ReportEngine(ReportEnginePrivate &dd, QObject *parent) connect(d, SIGNAL(renderFinished()), this, SIGNAL(renderFinished())); } +bool ReportEngine::showDesignerModal() const +{ + return m_showDesignerModal; +} + +void ReportEngine::setShowDesignerModal(bool showDesignerModal) +{ + m_showDesignerModal = showDesignerModal; +} + ScriptEngineManager*LimeReport::ReportEnginePrivate::scriptManager(){ ScriptEngineManager::instance().setContext(scriptContext()); ScriptEngineManager::instance().setDataManager(dataManager()); diff --git a/limereport/lrreportengine.h b/limereport/lrreportengine.h index 8ef7ff0..6509302 100644 --- a/limereport/lrreportengine.h +++ b/limereport/lrreportengine.h @@ -208,6 +208,9 @@ public: bool showPreparedPages(PreviewHints hints = PreviewBarsUserSetting); bool prepareReportPages(); bool printPreparedPages(); + bool showDesignerModal() const; + void setShowDesignerModal(bool showDesignerModal); + signals: void cleared(); void renderStarted(); @@ -241,6 +244,7 @@ protected: private: Q_DECLARE_PRIVATE(ReportEngine) static QSettings* m_settings; + bool m_showDesignerModal; }; } // namespace LimeReport diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index 3196f4e..2453b90 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -179,7 +179,7 @@ public: void previewReport(QPrinter* printer, PreviewHints hints = PreviewBarsUserSetting); ReportDesignWindowInterface* getDesignerWindow(); - void designReport(); + void designReport(bool showModal); void setSettings(QSettings* value); void setShowProgressDialog(bool value){m_showProgressDialog = value;} bool isShowProgressDialog() const {return m_showProgressDialog;}