Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix black squares in selection action panel by returning to the old behaviour for qt5

Wolthera van Hövell tot Westerflier38448b664e06
diff --git a/libs/ui/kis_selection_actions_panel_button.cpp b/libs/ui/kis_selection_actions_panel_button.cpp
index 118505c80f..8e0f52d330 100644
--- a/libs/ui/kis_selection_actions_panel_button.cpp
+++ b/libs/ui/kis_selection_actions_panel_button.cpp
@@ -48,14 +48,16 @@ void KisSelectionActionsPanelButton::draw(QPainter &painter, const KoColorDispla
}
int padding = ICON_SIZE_OFFSET / 2;
- QImage ic = displayRendererInterface->convertImageToDisplayColorSpace(icon().pixmap(rect.width()-(padding*2), rect.height()-(padding*2)).toImage());
+
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- QRect target = QRect(QPoint(0, 0), ic.size()/ic.devicePixelRatioF());
+ icon().paint(&painter, rect.marginsRemoved(QMargins(padding, padding, padding, padding)));
#else
+ QImage ic = displayRendererInterface->convertImageToDisplayColorSpace(icon().pixmap(rect.width()-(padding*2), rect.height()-(padding*2)).toImage());
QRect target = QRect(QPoint(0, 0), ic.deviceIndependentSize().toSize());
-#endif
target.moveCenter(rect.center());
painter.drawImage(target.intersected(rect.marginsRemoved(QMargins(padding, padding, padding, padding))), ic);
+#endif
+
}
diff --git a/libs/ui/kis_selection_actions_panel_handle.cpp b/libs/ui/kis_selection_actions_panel_handle.cpp
index 9237662fc8..5d6cfe9741 100644
--- a/libs/ui/kis_selection_actions_panel_handle.cpp
+++ b/libs/ui/kis_selection_actions_panel_handle.cpp
@@ -55,14 +55,15 @@ void KisSelectionActionsPanelHandle::draw(QPainter& painter, const KoColorDispla
painter.fillRect(rect.marginsAdded(QMargins(-3, 4, 1, 4)), renderInterface->systemPaletteForDisplayColorSpace().window().color());
// Adjusting the icon location a bit to be properly centered
- QImage ic = renderInterface->convertImageToDisplayColorSpace(d->handle_icon.pixmap(d->size, d->size).toImage());
+
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
- QRect target = QRect(QPoint(0, 0), ic.size()/ic.devicePixelRatioF());
+ d->handle_icon.paint(&painter, QRect(rect.x() + 3, rect.y(), d->size, d->size));
#else
+ QImage ic = renderInterface->convertImageToDisplayColorSpace(d->handle_icon.pixmap(d->size, d->size).toImage());
QRect target = QRect(QPoint(0, 0), ic.deviceIndependentSize().toSize());
-#endif
target.moveCenter(rect.center() + QPoint(3, 0));
painter.drawImage(target, ic);
+#endif
}
void KisSelectionActionsPanelHandle::contextMenuEvent(QContextMenuEvent *event)