Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Backports:SLE-15-SP3
calligra
0001-Revert-Chart-Depend-on-KChart-2.7.0.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Revert-Chart-Depend-on-KChart-2.7.0.patch of Package calligra
From 239b0429f5c2e0535416652c8e061377fab76248 Mon Sep 17 00:00:00 2001 From: Wolfgang Bauer <wbauer@tmo.at> Date: Thu, 30 Apr 2020 09:30:08 +0200 Subject: [PATCH] Revert "Chart: Depend on KChart 2.7.0" Allow to build calligra's chartshape with KChart/kdiagram 2.6.x again, which is the version we have in Leap 15.1. Except for one bugfix that needs the newer KChart version (https://bugs.kde.org/420145), this should make no difference. This reverts commit 2269397a6fa5f2ec4c94be8f50dc5c09d02f02ca. --- CMakeLists.txt | 2 +- plugins/chartshape/Axis.cpp | 2 ++ plugins/chartshape/Legend.cpp | 32 ++++++++++++++++++++++++++++++++ plugins/chartshape/PlotArea.cpp | 3 +++ 4 files changed, 38 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d6bed795fa..5cc1dfd2f71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -454,7 +454,7 @@ set_package_properties(KF5Akonadi PROPERTIES ## ## Test for KChart ## -macro_optional_find_package(KChart 2.7.0 QUIET) +macro_optional_find_package(KChart 2.6.0 QUIET) set_package_properties(KChart PROPERTIES DESCRIPTION "Library for creating business charts (part of KDiagram)" URL "https://www.kde.org/" diff --git a/plugins/chartshape/Axis.cpp b/plugins/chartshape/Axis.cpp index dd98dfb59d4..c4ca7e9e1cc 100644 --- a/plugins/chartshape/Axis.cpp +++ b/plugins/chartshape/Axis.cpp @@ -260,7 +260,9 @@ Axis::Private::Private(Axis *axis, AxisDimension dim) KChart::RulerAttributes attr = kdAxis->rulerAttributes(); attr.setShowRulerLine(true); +#if KCHART_VERSION >= ((2<<16)|(6<<8)|(89)) attr.setRulerLinePen(QPen()); +#endif kdAxis->setRulerAttributes(attr); } diff --git a/plugins/chartshape/Legend.cpp b/plugins/chartshape/Legend.cpp index 092d2808805..a4794248fc8 100644 --- a/plugins/chartshape/Legend.cpp +++ b/plugins/chartshape/Legend.cpp @@ -352,6 +352,7 @@ void Legend::paint(QPainter &painter, const KoViewConverter &converter, KoShapeP background()->paint(painter, converter, paintContext, p); } +#if KCHART_VERSION >= ((2<<16)|(6<<8)|(89)) disconnect (d->kdLegend, SIGNAL(propertiesChanged()), this, SLOT(slotKdLegendChanged())); // KChart thinks in pixels, Calligra in pt @@ -362,6 +363,37 @@ void Legend::paint(QPainter &painter, const KoViewConverter &converter, KoShapeP d->kdLegend->paint(&painter, rect); connect (d->kdLegend, SIGNAL(propertiesChanged()), this, SLOT(slotKdLegendChanged())); +#else + // KChart thinks in pixels, Calligra in pt + // KChart also for non-QWidget painting devices cares for the logicalDpi + // Other than PlotArea we do not control the output size via the paint method, + // so here have to resize the legend temporarily. + // Printing should only result in 1 paint call, so this should not happen too often. + // TODO: something in KChart seems broken in general on printer output, also seen in kchart examples + // so legend in print is still broken :/ + const QSize sizePx = d->kdLegend->size(); + const QSize newSizePx = ScreenConversions::scaleFromPtToPx(size(), painter); + const bool isPainterDifferentDpi = (sizePx != newSizePx); + if (isPainterDifferentDpi) { + // temporarily set a size matching the painterdevice + d->kdLegend->resize(newSizePx); + d->kdLegend->resizeLayout(newSizePx); + } + + ScreenConversions::scaleFromPtToPx(painter); + + d->kdLegend->paint(&painter); + + if (isPainterDifferentDpi) { + // restore screen-dpi size + d->kdLegend->resize(sizePx); + d->kdLegend->resizeLayout(sizePx); + } + + //painter.restore(); + // Paint the cached pixmap + //painter.drawImage(0, 0, d->image); +#endif } diff --git a/plugins/chartshape/PlotArea.cpp b/plugins/chartshape/PlotArea.cpp index 55aca8bb217..dbeccd48d9f 100644 --- a/plugins/chartshape/PlotArea.cpp +++ b/plugins/chartshape/PlotArea.cpp @@ -1313,6 +1313,9 @@ void PlotArea::paint(QPainter& painter, const KoViewConverter& converter, KoShap // is not not cut off. painter.setClipping(false); if (kdchartRect.width() > 10 && kdchartRect.height() > 10) { +#if KCHART_VERSION < 0x020689 + painter.setPen(QPen()); // ruler line needs a pen to be shown +#endif d->kdChart->paint(&painter, kdchartRect); } //painter.restore(); -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor