From 3f08e6467815b004d9bb6136eda32a3623a140e8 Mon Sep 17 00:00:00 2001 From: Loren Burkholder Date: Mon, 20 Nov 2023 11:19:22 -0500 Subject: [PATCH 1/5] Fix alignment of labels in plaintext legends Previously, KDChart would calculate a bounding rectangle for the text and then center that in the space provided for the text. This meant that setting a text alignment essentially had no effect. Now KDChart will take advantage of all available space for aligning text. --- src/KDChart/KDChartLayoutItems.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/KDChart/KDChartLayoutItems.cpp b/src/KDChart/KDChartLayoutItems.cpp index c21fa9cf..7fab89a6 100644 --- a/src/KDChart/KDChartLayoutItems.cpp +++ b/src/KDChart/KDChartLayoutItems.cpp @@ -479,8 +479,7 @@ void KDChart::TextLayoutItem::paint(QPainter *painter) } painter->setFont(f); - QSize innerSize = unrotatedTextSize(); - QRectF rect = QRectF(QPointF(0, 0), innerSize); + QRectF rect = mRect; rect.translate(-rect.center()); painter->translate(mRect.center()); painter->rotate(mAttributes.rotation()); From aa6074b460c30e609f366476bbc45987e7d46c53 Mon Sep 17 00:00:00 2001 From: Daniel Nicoletti Date: Thu, 14 Sep 2023 20:28:56 -0300 Subject: [PATCH 2/5] Fix warning when using with string builder enabled (cherry picked from commit 1ccb5531d19db62fe79c3d1fba8c3982a798b8c2) --- src/KDChart/KDChartAttributesModel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/KDChart/KDChartAttributesModel.cpp b/src/KDChart/KDChartAttributesModel.cpp index 4161ab65..a9fe7726 100644 --- a/src/KDChart/KDChartAttributesModel.cpp +++ b/src/KDChart/KDChartAttributesModel.cpp @@ -247,7 +247,7 @@ QVariant AttributesModel::defaultHeaderData(int section, Qt::Orientation orienta switch (role) { case Qt::DisplayRole: // TODO for KDChart 3.0: return QString::number( dataset + 1 ); - return QLatin1String(orientation == Qt::Vertical ? "Series " : "Item ") + QString::number(dataset); + return QString{QLatin1String(orientation == Qt::Vertical ? "Series " : "Item ") + QString::number(dataset)}; case KDChart::DatasetBrushRole: return d->palette.getBrush(dataset); case KDChart::DatasetPenRole: From 5592dffc2960beadebd707053dcb30f2affd9ba4 Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 12 Dec 2023 23:19:10 +0100 Subject: [PATCH 3/5] Add missing override keywords (found by -Wsuggest-override) (cherry picked from commit 7a6b565c0c522eac45a2b03a9789f2996e58a8fa) --- src/KDChart/KDChartNullPaintDevice.h | 44 ++++++++++++++-------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/KDChart/KDChartNullPaintDevice.h b/src/KDChart/KDChartNullPaintDevice.h index 5afff522..1cffff71 100644 --- a/src/KDChart/KDChartNullPaintDevice.h +++ b/src/KDChart/KDChartNullPaintDevice.h @@ -18,65 +18,65 @@ namespace KDChart { class NullPaintEngine : public QPaintEngine { public: - virtual bool begin(QPaintDevice * /*pdev*/) + bool begin(QPaintDevice * /*pdev*/) override { return true; } - virtual void drawEllipse(const QRectF & /*rect*/) + void drawEllipse(const QRectF & /*rect*/) override { } - virtual void drawEllipse(const QRect & /*rect*/) + void drawEllipse(const QRect & /*rect*/) override { } - virtual void drawImage(const QRectF & /*rectangle*/, const QImage & /*image*/, const QRectF & /*sr*/, Qt::ImageConversionFlags /*flags*/) + void drawImage(const QRectF & /*rectangle*/, const QImage & /*image*/, const QRectF & /*sr*/, Qt::ImageConversionFlags /*flags*/) override { } - virtual void drawLines(const QLineF * /*lines*/, int /*lineCount*/) + void drawLines(const QLineF * /*lines*/, int /*lineCount*/) override { } - virtual void drawLines(const QLine * /*lines*/, int /*lineCount*/) + void drawLines(const QLine * /*lines*/, int /*lineCount*/) override { } - virtual void drawPath(const QPainterPath & /*path*/) + void drawPath(const QPainterPath & /*path*/) override { } - virtual void drawPixmap(const QRectF & /*r*/, const QPixmap & /*pm*/, const QRectF & /*sr*/) + void drawPixmap(const QRectF & /*r*/, const QPixmap & /*pm*/, const QRectF & /*sr*/) override { } - virtual void drawPoints(const QPointF * /*points*/, int /*pointCount*/) + void drawPoints(const QPointF * /*points*/, int /*pointCount*/) override { } - virtual void drawPoints(const QPoint * /*points*/, int /*pointCount*/) + void drawPoints(const QPoint * /*points*/, int /*pointCount*/) override { } - virtual void drawPolygon(const QPointF * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) + void drawPolygon(const QPointF * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) override { } - virtual void drawPolygon(const QPoint * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) + void drawPolygon(const QPoint * /*points*/, int /*pointCount*/, PolygonDrawMode /*mode*/) override { } - virtual void drawRects(const QRectF * /*rects*/, int /*rectCount*/) + void drawRects(const QRectF * /*rects*/, int /*rectCount*/) override { } - virtual void drawRects(const QRect * /*rects*/, int /*rectCount*/) + void drawRects(const QRect * /*rects*/, int /*rectCount*/) override { } - virtual void drawTextItem(const QPointF & /*p*/, const QTextItem & /*textItem*/) + void drawTextItem(const QPointF & /*p*/, const QTextItem & /*textItem*/) override { } - virtual void drawTiledPixmap(const QRectF & /*rect*/, const QPixmap & /*pixmap*/, const QPointF & /*p*/) + void drawTiledPixmap(const QRectF & /*rect*/, const QPixmap & /*pixmap*/, const QPointF & /*p*/) override { } - virtual bool end() + bool end() override { return true; } - virtual Type type() const + Type type() const override { return QPaintEngine::User; } - virtual void updateState(const QPaintEngineState & /*state*/) + void updateState(const QPaintEngineState & /*state*/) override { } }; @@ -88,11 +88,11 @@ class NullPaintDevice : public QPaintDevice : m_size(size) { } - ~NullPaintDevice() + ~NullPaintDevice() override { } - int metric(PaintDeviceMetric metric) const + int metric(PaintDeviceMetric metric) const override { switch (metric) { case QPaintDevice::PdmWidth: @@ -125,7 +125,7 @@ class NullPaintDevice : public QPaintDevice return 1; } - QPaintEngine *paintEngine() const + QPaintEngine *paintEngine() const override { static NullPaintEngine nullPaintEngine; return &nullPaintEngine; From 7e4b008c35ed5f0baabd4b250f50e89301708c97 Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 13 Dec 2023 23:37:45 +0100 Subject: [PATCH 4/5] Only call feature_summary when not a submodule Otherwise the feature summary is printed multiple times. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 566bca04..a46746d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,6 +306,6 @@ endif() if(${PROJECT_NAME}_IS_ROOT_PROJECT) # Add uninstall target (not for submodules since parent projects typically have uninstall too) include(ECMUninstallTarget) -endif() -feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) + feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) +endif() From d87886c16707b6434dc0bf7b11cc6b93153c0766 Mon Sep 17 00:00:00 2001 From: Allen Winter Date: Thu, 14 Dec 2023 06:41:33 -0500 Subject: [PATCH 5/5] .pre-commit-config.yaml - autoupdate and add a few more hooks Add these hooks: * check-xml * check-symlinks: checks for symlinks which do not point to anything * destroyed-symlinks: detects symlinks which are changed to regular files with a content of a path which that symlink was pointing to. * check-executables-have-shebangs: ensures that (non-binary) executables have a shebang. --- .pre-commit-config.yaml | 7 +++++-- src/KDChart/KDChartAttributesModel.cpp | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d38bd5e8..c076d80a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,12 +15,15 @@ repos: - id: check-yaml args: [--allow-multiple-documents] - id: check-json + - id: check-symlinks + - id: destroyed-symlinks + - id: check-executables-have-shebangs - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v17.0.3 + rev: v17.0.6 hooks: - id: clang-format - repo: https://github.com/PyCQA/pylint - rev: v3.0.1 + rev: v3.0.3 hooks: - id: pylint exclude: ^(.cmake-format.py|conan/conanfile.py|scripts/genignore.py) diff --git a/src/KDChart/KDChartAttributesModel.cpp b/src/KDChart/KDChartAttributesModel.cpp index a9fe7726..ff5fbeeb 100644 --- a/src/KDChart/KDChartAttributesModel.cpp +++ b/src/KDChart/KDChartAttributesModel.cpp @@ -247,7 +247,7 @@ QVariant AttributesModel::defaultHeaderData(int section, Qt::Orientation orienta switch (role) { case Qt::DisplayRole: // TODO for KDChart 3.0: return QString::number( dataset + 1 ); - return QString{QLatin1String(orientation == Qt::Vertical ? "Series " : "Item ") + QString::number(dataset)}; + return QString {QLatin1String(orientation == Qt::Vertical ? "Series " : "Item ") + QString::number(dataset)}; case KDChart::DatasetBrushRole: return d->palette.getBrush(dataset); case KDChart::DatasetPenRole: