New option Reset label position.
This commit is contained in:
parent
c476d4b96a
commit
40fb6e6900
|
@ -4,6 +4,7 @@
|
|||
- Fix incorrect nesting status for valid cases.
|
||||
- Improve crossing check for the layout algorithm.
|
||||
- Fix crash after creating an elliptical arc.
|
||||
- New option Reset label position.
|
||||
|
||||
# Version 0.7.40 Nov 23, 2020
|
||||
- New function Warning.
|
||||
|
|
|
@ -1175,8 +1175,8 @@ void VPattern::PointsCommonAttributes(const QDomElement &domElement, VToolSingle
|
|||
void VPattern::PointsCommonAttributes(const QDomElement &domElement, quint32 &id, qreal &mx, qreal &my)
|
||||
{
|
||||
ToolsCommonAttributes(domElement, id);
|
||||
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("10.0")));
|
||||
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("15.0")));
|
||||
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
|
||||
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -1184,8 +1184,8 @@ void VPattern::DrawPointsCommonAttributes(const QDomElement &domElement, quint32
|
|||
QString ¬es)
|
||||
{
|
||||
DrawToolsCommonAttributes(domElement, id, notes);
|
||||
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QStringLiteral("10.0")));
|
||||
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QStringLiteral("15.0")));
|
||||
mx = qApp->toPixel(GetParametrDouble(domElement, AttrMx, QString::number(labelMX)));
|
||||
my = qApp->toPixel(GetParametrDouble(domElement, AttrMy, QString::number(labelMY)));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -2459,13 +2459,13 @@ void VPattern::ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &
|
|||
initData.dartP3Id = GetParametrUInt(domElement, AttrDartP3, NULL_ID_STR);
|
||||
|
||||
initData.name1 = GetParametrString(domElement, AttrName1, QChar('A'));
|
||||
initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, QStringLiteral("10.0")));
|
||||
initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, QStringLiteral("15.0")));
|
||||
initData.mx1 = qApp->toPixel(GetParametrDouble(domElement, AttrMx1, QString::number(labelMX)));
|
||||
initData.my1 = qApp->toPixel(GetParametrDouble(domElement, AttrMy1, QString::number(labelMY)));
|
||||
initData.showLabel1 = GetParametrBool(domElement, AttrShowLabel1, trueStr);
|
||||
|
||||
initData.name2 = GetParametrString(domElement, AttrName2, QChar('A'));
|
||||
initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, QStringLiteral("10.0")));
|
||||
initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, QStringLiteral("15.0")));
|
||||
initData.mx2 = qApp->toPixel(GetParametrDouble(domElement, AttrMx2, QString::number(labelMX)));
|
||||
initData.my2 = qApp->toPixel(GetParametrDouble(domElement, AttrMy2, QString::number(labelMY)));
|
||||
initData.showLabel2 = GetParametrBool(domElement, AttrShowLabel2, trueStr);
|
||||
|
||||
VToolTrueDarts::Create(initData);
|
||||
|
|
|
@ -152,7 +152,7 @@ protected:
|
|||
virtual void ReadToolAttributes(const QDomElement &domElement) override;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) override;
|
||||
|
||||
void UpdateNamePosition(quint32 id, const QPointF &pos);
|
||||
virtual void UpdateNamePosition(quint32 id, const QPointF &pos) override;
|
||||
void SaveSourceDestination(QDomElement &tag);
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -56,8 +56,8 @@ struct VToolTrueDartsInitData : VDrawToolInitData
|
|||
dartP2Id(NULL_ID),
|
||||
dartP3Id(NULL_ID),
|
||||
name1(),
|
||||
mx1(10),
|
||||
my1(15),
|
||||
mx1(labelMX),
|
||||
my1(labelMY),
|
||||
showLabel1(true),
|
||||
name2(),
|
||||
mx2(10),
|
||||
|
|
|
@ -50,8 +50,8 @@ struct VToolBasePointInitData : VToolSinglePointInitData
|
|||
VToolBasePointInitData()
|
||||
: VToolSinglePointInitData(),
|
||||
nameActivPP(),
|
||||
x(10),
|
||||
y(10)
|
||||
x(labelMX),
|
||||
y(labelMY)
|
||||
{}
|
||||
|
||||
QString nameActivPP;
|
||||
|
|
|
@ -49,8 +49,8 @@ struct VToolSinglePointInitData : VDrawToolInitData
|
|||
VToolSinglePointInitData()
|
||||
: VDrawToolInitData(),
|
||||
name(),
|
||||
mx(5),
|
||||
my(10),
|
||||
mx(labelMX),
|
||||
my(labelMY),
|
||||
showLabel(true)
|
||||
{}
|
||||
|
||||
|
|
|
@ -68,8 +68,6 @@ public slots:
|
|||
protected:
|
||||
void SetPointName(quint32 id, const QString &name);
|
||||
|
||||
virtual void UpdateNamePosition(quint32 id, const QPointF &pos)=0;
|
||||
|
||||
template <typename T>
|
||||
static void InitToolConnections(VMainGraphicsScene *scene, T *tool);
|
||||
|
||||
|
|
|
@ -185,6 +185,13 @@ QString VDrawTool::MakeToolTip() const
|
|||
return QString();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VDrawTool::UpdateNamePosition(quint32 id, const QPointF &pos)
|
||||
{
|
||||
Q_UNUSED(id)
|
||||
Q_UNUSED(pos)
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
bool VDrawTool::CorrectDisable(bool disable, const QString &namePP) const
|
||||
{
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "../vdatatool.h"
|
||||
#include "../vgeometry/vpointf.h"
|
||||
#include "../vtools/undocommands/undogroup.h"
|
||||
#include "../toolsdef.h"
|
||||
|
||||
struct VDrawToolInitData : VAbstractToolInitData
|
||||
{
|
||||
|
@ -120,6 +121,7 @@ protected:
|
|||
void SaveOption(QSharedPointer<VGObject> &obj);
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj);
|
||||
virtual QString MakeToolTip() const;
|
||||
virtual void UpdateNamePosition(quint32 id, const QPointF &pos);
|
||||
|
||||
bool CorrectDisable(bool disable, const QString &namePP) const;
|
||||
|
||||
|
@ -241,6 +243,9 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
actionShowLabel->setVisible(false);
|
||||
}
|
||||
|
||||
QAction *actionRestoreLabelPosition = menu.addAction(VDrawTool::tr("Restore label position"));
|
||||
actionRestoreLabelPosition->setVisible(itemType == GOType::Point);
|
||||
|
||||
QAction *actionRemove = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), VDrawTool::tr("Delete"));
|
||||
if (showRemove == RemoveOption::Enable)
|
||||
{
|
||||
|
@ -299,6 +304,10 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
{
|
||||
ChangeLabelVisibility(itemId, selectedAction->isChecked());
|
||||
}
|
||||
else if (selectedAction == actionRestoreLabelPosition)
|
||||
{
|
||||
UpdateNamePosition(itemId, QPointF(labelMX, labelMY));
|
||||
}
|
||||
else if (selectedAction->actionGroup() == actionsAddToGroup)
|
||||
{
|
||||
quint32 groupId = selectedAction->data().toUInt();
|
||||
|
|
|
@ -47,6 +47,10 @@ struct SourceItem
|
|||
Q_DECLARE_METATYPE(SourceItem)
|
||||
Q_DECLARE_TYPEINFO(SourceItem, Q_MOVABLE_TYPE);
|
||||
|
||||
// Default label position
|
||||
const int labelMX = 10;
|
||||
const int labelMY = 15;
|
||||
|
||||
QVector<quint32> SourceToObjects(const QVector<SourceItem> &source);
|
||||
|
||||
QString OriginAlias(quint32 id, const QVector<SourceItem> &source, const QSharedPointer<VGObject> &obj);
|
||||
|
|
Loading…
Reference in New Issue
Block a user