From d34754ea81ffa8a25909ba56c2684da04fe722f8 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 2 May 2025 21:20:46 +0200 Subject: [PATCH] QStyleSheetstyle: misc cleanup of QStyleSheetBorderImageData Remove unused member 'image' from QStyleSheetBorderImageData and replace c array with std::array<>. Pick-to: 6.9 Change-Id: I149ef72e443027a6b6d30f25e8c7b1adf4138fc5 Reviewed-by: Axel Spoerl --- src/widgets/styles/qstylesheetstyle.cpp | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp index 5253a011c8f..bedf11b1b6f 100644 --- a/src/widgets/styles/qstylesheetstyle.cpp +++ b/src/widgets/styles/qstylesheetstyle.cpp @@ -333,16 +333,10 @@ static const PseudoElementInfo knownPseudoElements[NumPseudoElements] = { struct QStyleSheetBorderImageData : public QSharedData { - QStyleSheetBorderImageData() - : horizStretch(QCss::TileMode_Unknown), vertStretch(QCss::TileMode_Unknown) - { - for (int i = 0; i < 4; i++) - cuts[i] = -1; - } - int cuts[4]; + std::array cuts = {-1, -1, -1, -1}; + QCss::TileMode horizStretch = QCss::TileMode_Unknown; + QCss::TileMode vertStretch = QCss::TileMode_Unknown; QPixmap pixmap; - QImage image; - QCss::TileMode horizStretch, vertStretch; }; struct QStyleSheetBackgroundData : public QSharedData @@ -1015,9 +1009,9 @@ QRenderRule::QRenderRule(const QList &declarations, const QObject * if (decl.d->propertyId == BorderImage) { QString uri; QCss::TileMode horizStretch, vertStretch; - int cuts[4]; + std::array cuts; - decl.borderImageValue(&uri, cuts, &horizStretch, &vertStretch); + decl.borderImageValue(&uri, cuts.data(), &horizStretch, &vertStretch); if (uri.isEmpty() || uri == "none"_L1) { if (bd && bd->bi) bd->bi->pixmap = QPixmap(); @@ -1029,8 +1023,7 @@ QRenderRule::QRenderRule(const QList &declarations, const QObject * QStyleSheetBorderImageData *bi = bd->bi; bi->pixmap = QStyleSheetStyle::loadPixmap(uri, object); - for (int i = 0; i < 4; i++) - bi->cuts[i] = cuts[i]; + bi->cuts = cuts; bi->horizStretch = horizStretch; bi->vertStretch = vertStretch; } @@ -1229,7 +1222,7 @@ void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect) const QStyleSheetBorderImageData *borderImageData = border()->borderImage(); const int *targetBorders = border()->borders; - const int *sourceBorders = borderImageData->cuts; + const auto sourceBorders = borderImageData->cuts; QMargins sourceMargins(sourceBorders[LeftEdge], sourceBorders[TopEdge], sourceBorders[RightEdge], sourceBorders[BottomEdge]); QMargins targetMargins(targetBorders[LeftEdge], targetBorders[TopEdge],