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 testing the contour enter button when the text has no contours.

Wolthera van Hövell tot Westerfliere40702a9489a
diff --git a/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp b/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp
index b45d14e4ef..256eec2c2f 100644
--- a/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp
+++ b/libs/flake/text/KoSvgTextShapeOutlineHelper.cpp
@@ -40,7 +40,7 @@ struct KoSvgTextShapeOutlineHelper::Private {
KoSvgTextShape *getPotentialTextShape(const QPointF &point) {
Q_FOREACH(KoShape*shape, canvas->shapeManager()->selection()->selectedEditableShapes()) {
KoSvgTextShape *text = dynamic_cast<KoSvgTextShape*>(shape);
- if (text) {
+ if (text && !text->internalShapeManager()->shapes().isEmpty()) {
if (getButtonRectCorrected(text->boundingRect()).contains(point)) {
return text;
}
@@ -173,7 +173,9 @@ QRectF KoSvgTextShapeOutlineHelper::decorationRect()
KoSvgTextShape *text = d->getTextModeShape();
if (text) {
QRectF base = text->boundingRect();
- base |= d->getButtonRectCorrected(base);
+ if (!text->internalShapeManager()->shapes().isEmpty()) {
+ base |= d->getButtonRectCorrected(base);
+ }
decorationRect = base;
} else {
Q_FOREACH(KoShape* shape, d->canvas->shapeManager()->selection()->selectedEditableShapes()) {
@@ -225,9 +227,10 @@ void KoSvgTextShapeOutlineHelper::setDecorationThickness(int thickness)
KoSvgTextShape *KoSvgTextShapeOutlineHelper::contourModeButtonHovered(const QPointF &point)
{
- if (d->getTextModeShape()) {
- if (d->getButtonRect(d->getTextModeShape()->boundingRect()).contains(point)) {
- return d->getTextModeShape();
+ KoSvgTextShape *text = d->getTextModeShape();
+ if (text && !text->internalShapeManager()->shapes().isEmpty()) {
+ if (d->getButtonRect(text->boundingRect()).contains(point)) {
+ return text;
}
}
return d->getPotentialTextShape(point);