Refactor selection of last used annotation tool

remotes/origin/work/spdx
Simone Gaiarin 5 years ago
parent 34b8c1e72e
commit e000489268
  1. 19
      part/pageviewannotator.cpp
  2. 2
      part/pageviewannotator.h

@ -1062,7 +1062,7 @@ QRect PageViewAnnotator::performRouteMouseOrTabletEvent(const AnnotatorEngine::E
}
if (m_continuousMode)
selectTool(m_lastToolId, ShowTip::No);
selectLastTool();
else
detachAnnotation();
}
@ -1260,6 +1260,11 @@ void PageViewAnnotator::selectTool(int toolId, ShowTip showTip)
emit toolSelected();
}
void PageViewAnnotator::selectLastTool()
{
selectTool(m_lastToolId, ShowTip::No);
}
void PageViewAnnotator::selectStampTool(const QString &stampSymbol)
{
QDomElement toolElement = builtinTool(STAMP_TOOL_ID);
@ -1539,7 +1544,7 @@ void PageViewAnnotator::setAnnotationWidth(double width)
{
currentAnnotationElement().setAttribute(QStringLiteral("width"), QString::number(width));
saveBuiltinAnnotationTools();
selectTool(m_lastToolId, ShowTip::No);
selectLastTool();
}
void PageViewAnnotator::setAnnotationColor(const QColor &color)
@ -1553,7 +1558,7 @@ void PageViewAnnotator::setAnnotationColor(const QColor &color)
annotationElement.setAttribute(QStringLiteral("color"), color.name(QColor::HexRgb));
}
saveBuiltinAnnotationTools();
selectTool(m_lastToolId, ShowTip::No);
selectLastTool();
}
void PageViewAnnotator::setAnnotationInnerColor(const QColor &color)
@ -1565,21 +1570,21 @@ void PageViewAnnotator::setAnnotationInnerColor(const QColor &color)
annotationElement.setAttribute(QStringLiteral("innerColor"), color.name(QColor::HexRgb));
}
saveBuiltinAnnotationTools();
selectTool(m_lastToolId, ShowTip::No);
selectLastTool();
}
void PageViewAnnotator::setAnnotationOpacity(double opacity)
{
currentAnnotationElement().setAttribute(QStringLiteral("opacity"), QString::number(opacity));
saveBuiltinAnnotationTools();
selectTool(m_lastToolId, ShowTip::No);
selectLastTool();
}
void PageViewAnnotator::setAnnotationFont(const QFont &font)
{
currentAnnotationElement().setAttribute(QStringLiteral("font"), font.toString());
saveBuiltinAnnotationTools();
selectTool(m_lastToolId, ShowTip::No);
selectLastTool();
}
void PageViewAnnotator::addToQuickAnnotations()
@ -1615,7 +1620,7 @@ void PageViewAnnotator::slotAdvancedSettings()
int toolId = toolElement.attribute(QStringLiteral("id")).toInt();
m_builtinToolsDefinition->updateTool(toolElementUpdated, toolId);
saveBuiltinAnnotationTools();
selectTool(m_lastToolId, ShowTip::No);
selectLastTool();
}
/* kate: replace-tabs on; indent-width 4; */

@ -112,6 +112,8 @@ public:
void selectStampTool(const QString &stampSymbol);
// makes a quick annotation the active tool
int setQuickTool(int toolId);
// selects the last used tool
void selectLastTool();
// deselects the tool and uncheck all the annotation actions
void detachAnnotation();

Loading…
Cancel
Save