[graphics/drawy/gsoc2026] src/widgets/tools: fix: don't allow editing locked text items
Abdelhadi Wael <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 64c8da83e913ea5f4a3ed76b91afb5a61e54effa by Abdelhadi Wael.
Committed on 16/07/2026 at 07:57.
Pushed by mlaurent into branch 'gsoc2026'.
fix: don't allow editing locked text items
M +1 -1 src/widgets/tools/selectiontool/selectiontool.cpp
M +2 -2 src/widgets/tools/texttool.cpp
https://invent.kde.org/graphics/drawy/-/commit/64c8da83e913ea5f4a3ed76b91afb5a61e54effa
diff --git a/src/widgets/tools/selectiontool/selectiontool.cpp b/src/widgets/tools/selectiontool/selectiontool.cpp
index 5ce66e51..1652c8d0 100644
--- a/src/widgets/tools/selectiontool/selectiontool.cpp
+++ b/src/widgets/tools/selectiontool/selectiontool.cpp
@@ -358,7 +358,7 @@ void SelectionTool::mouseDoubleClick(ApplicationContext *context)
{
const auto &items{getItemsUnderCursor(context)};
- if (!items.empty() && items.back()->formType() == Item::FormType::Text) {
+ if (!items.empty() && items.back()->formType() == Item::FormType::Text && !items.back()->locked()) {
auto toolBar{context->uiContext()->toolBar()};
toolBar->changeTool(Tool::Type::Text);
diff --git a/src/widgets/tools/texttool.cpp b/src/widgets/tools/texttool.cpp
index e8412e22..aed8004e 100644
--- a/src/widgets/tools/texttool.cpp
+++ b/src/widgets/tools/texttool.cpp
@@ -59,7 +59,7 @@ void TextTool::mousePressed(ApplicationContext *context)
const QPointF worldPos{transformer.viewToWorld(uiContext->appEvent()->pos())};
QList<std::shared_ptr<Item>> intersectingItems{quadTree.queryItems(worldPos, [](const std::shared_ptr<Item> &item, const QPointF &point) {
- return item->formType() == Item::FormType::Text && item->boundingBox().contains(point);
+ return item->formType() == Item::FormType::Text && !item->locked() && item->boundingBox().contains(point);
})};
if (intersectingItems.empty()) {
@@ -128,7 +128,7 @@ void TextTool::mouseMoved(ApplicationContext *context)
renderingContext->canvas()->setCursor(Qt::IBeamCursor);
} else {
const QList<std::shared_ptr<Item>> intersectingItems{quadTree.queryItems(worldPos, [](const std::shared_ptr<Item> &item, const QPointF &point) {
- return item->formType() == Item::FormType::Text && item->boundingBox().contains(point);
+ return item->formType() == Item::FormType::Text && !item->locked() && item->boundingBox().contains(point);
})};
if (!intersectingItems.empty()) {