Merged develop into feature

--HG--
branch : feature
This commit is contained in:
Bojan Kverh 2016-06-24 17:57:52 +02:00
commit 3480f33922
27 changed files with 244 additions and 20 deletions

View File

@ -31,6 +31,7 @@
- [#409] New feature: Export measurement file to Excel .csv.
- [#180] New feature: Search field in tape app and dialog Increments.
- [#514] Read only setting not working properly.
- [#480] New tool: Midpoint between two points.
# Version 0.4.5
- [#435] Valentina doesn't change the cursor.

View File

@ -75,7 +75,7 @@ void VToolOptionsPropertyBrowser::ClearPropertyBrowser()
void VToolOptionsPropertyBrowser::ShowItemOptions(QGraphicsItem *item)
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in switch.");
switch (item->type())
{
@ -199,7 +199,7 @@ void VToolOptionsPropertyBrowser::UpdateOptions()
}
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in switch.");
switch (currentItem->type())
{
@ -334,7 +334,7 @@ void VToolOptionsPropertyBrowser::userChangedData(VProperty *property)
}
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in switch.");
switch (currentItem->type())
{

View File

@ -208,7 +208,7 @@ void DialogHistory::FillTable()
QString DialogHistory::Record(const VToolRecord &tool)
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used in history.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used in history.");
const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false)
@ -226,6 +226,8 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::LinePoint:
case Tool::AbstractSpline:
case Tool::Cut:
case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type
case Tool::ArcIntersectAxis:// Same as Tool::CurveIntersectAxis, but tool will never has such type
case Tool::LAST_ONE_DO_NOT_USE:
Q_UNREACHABLE(); //-V501
break;

View File

@ -610,6 +610,11 @@ void MainWindow::SetToolButtonWithApply(bool checked, Tool t, const QString &cur
helpLabel->setText(toolTip);
dialogTool = new Dialog(pattern, NULL_ID, this);
if (t == Tool::Midpoint)
{
dialogTool->Build(t);
}
VMainGraphicsScene *scene = qobject_cast<VMainGraphicsScene *>(currentScene);
SCASSERT(scene != nullptr);
@ -750,6 +755,16 @@ void MainWindow::ToolAlongLine(bool checked)
&MainWindow::ApplyDialog<VToolAlongLine>);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolMidpoint(bool checked)
{
ToolSelectPointByRelease();
// Reuse DialogAlongLine and VToolAlongLine but with different cursor
SetToolButtonWithApply<DialogAlongLine>(checked, Tool::Midpoint, ":/cursor/midpoint_cursor.png",
tr("Select point"), &MainWindow::ClosedDialogWithApply<VToolAlongLine>,
&MainWindow::ApplyDialog<VToolAlongLine>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolShoulderPoint handler tool shoulderPoint.
@ -1081,7 +1096,7 @@ void MainWindow::ToolArcIntersectAxis(bool checked)
{
ToolSelectAllDrawObjects();
// Reuse ToolCurveIntersectAxis but with different cursor and tool tip
SetToolButtonWithApply<DialogCurveIntersectAxis>(checked, Tool::CurveIntersectAxis,
SetToolButtonWithApply<DialogCurveIntersectAxis>(checked, Tool::ArcIntersectAxis,
":/cursor/arc_intersect_axis_cursor.png",
tr("Select arc"),
&MainWindow::ClosedDialogWithApply<VToolCurveIntersectAxis>,
@ -1750,6 +1765,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonTrueDarts, &QToolButton::clicked, this, &MainWindow::ToolTrueDarts);
connect(ui->toolButtonGroup, &QToolButton::clicked, this, &MainWindow::ToolGroup);
connect(ui->toolButtonRotation, &QToolButton::clicked, this, &MainWindow::ToolRotation);
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1790,7 +1806,7 @@ void MainWindow::mouseMove(const QPointF &scenePos)
void MainWindow::CancelTool()
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was handled.");
qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool;
@ -1836,6 +1852,9 @@ void MainWindow::CancelTool()
case Tool::AlongLine:
ui->toolButtonAlongLine->setChecked(false);
break;
case Tool::Midpoint:
ui->toolButtonMidpoint->setChecked(false);
break;
case Tool::ShoulderPoint:
ui->toolButtonShoulderPoint->setChecked(false);
break;
@ -1898,6 +1917,8 @@ void MainWindow::CancelTool()
break;
case Tool::CurveIntersectAxis:
ui->toolButtonCurveIntersectAxis->setChecked(false);
break;
case Tool::ArcIntersectAxis:
ui->toolButtonArcIntersectAxis->setChecked(false);
break;
case Tool::PointOfIntersectionArcs:
@ -3133,6 +3154,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonTrueDarts->setEnabled(drawTools);
ui->toolButtonGroup->setEnabled(drawTools);
ui->toolButtonRotation->setEnabled(drawTools);
ui->toolButtonMidpoint->setEnabled(drawTools);
ui->actionLast_tool->setEnabled(drawTools);
@ -3412,7 +3434,7 @@ void MainWindow::CreateMenus()
void MainWindow::LastUsedTool()
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was handled.");
if (currentTool == lastUsedTool)
{
@ -3451,6 +3473,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonAlongLine->setChecked(true);
ToolAlongLine(true);
break;
case Tool::Midpoint:
ui->toolButtonMidpoint->setChecked(true);
ToolMidpoint(true);
break;
case Tool::ShoulderPoint:
ui->toolButtonShoulderPoint->setChecked(true);
ToolShoulderPoint(true);
@ -3535,6 +3561,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonCurveIntersectAxis->setChecked(true);
ToolCurveIntersectAxis(true);
break;
case Tool::ArcIntersectAxis:
ui->toolButtonArcIntersectAxis->setChecked(true);
ToolArcIntersectAxis(true);
break;
case Tool::PointOfIntersectionCircles:
ui->toolButtonPointOfIntersectionCircles->setChecked(true);
ToolPointOfIntersectionCircles(true);

View File

@ -104,6 +104,7 @@ public slots:
void ToolEndLine(bool checked);
void ToolLine(bool checked);
void ToolAlongLine(bool checked);
void ToolMidpoint(bool checked);
void ToolShoulderPoint(bool checked);
void ToolNormal(bool checked);
void ToolBisector(bool checked);

View File

@ -48,7 +48,7 @@
<string>Tools</string>
</property>
<property name="currentIndex">
<number>4</number>
<number>0</number>
</property>
<widget class="QWidget" name="page">
<property name="geometry">
@ -368,6 +368,32 @@
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QToolButton" name="toolButtonMidpoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Midpoint between two points</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/midpoint.png</normaloff>:/toolicon/32x32/midpoint.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_2">

View File

@ -68,5 +68,7 @@
<file>cursor/group_plus_cursor@2x.png</file>
<file>cursor/rotation_cursor.png</file>
<file>cursor/rotation_cursor@2x.png</file>
<file>cursor/midpoint_cursor.png</file>
<file>cursor/midpoint_cursor@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 910 B

View File

@ -66,5 +66,7 @@
<file>toolicon/32x32/group_plus@2x.png</file>
<file>toolicon/32x32/rotation.png</file>
<file>toolicon/32x32/rotation@2x.png</file>
<file>toolicon/32x32/midpoint.png</file>
<file>toolicon/32x32/midpoint@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 685 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
width="32"
height="32"
id="svg3837"
inkscape:version="0.91 r"
sodipodi:docname="midpoint.svg"
inkscape:export-filename="/home/dismine/CAD/Valentina_0.5.x/Valentina/src/app/valentina/share/resources/toolicon/32x32/midpoint@2.png"
inkscape:export-xdpi="180"
inkscape:export-ydpi="180">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1855"
inkscape:window-height="1056"
id="namedview12"
showgrid="false"
inkscape:zoom="14.75"
inkscape:cx="4.5124528"
inkscape:cy="20.515633"
inkscape:window-x="65"
inkscape:window-y="24"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs3839" />
<metadata
id="metadata3842">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
id="layer1">
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 5,4.5 27.998317,28.058453"
id="path4205"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
d="m 29.7585,27.987006 a 1.7375,1.7294948 0 0 1 -3.475,0 1.7375,1.7294948 0 1 1 3.475,0 z"
id="path2985-2"
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.56700003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.93950177"
inkscape:connector-curvature="0" />
<path
d="m 6.9338416,4.8053012 a 1.8239208,1.9086996 0 0 1 -3.6478416,0 1.8239208,1.9086996 0 1 1 3.6478416,0 z"
id="path2985-2-9"
style="fill:#000000;fill-opacity:1;stroke:#370000;stroke-width:1.57200003;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.93950177"
inkscape:connector-curvature="0" />
<path
d="m 18.044627,16.211054 a 1.694033,1.7299055 0 0 1 -3.388066,0 1.694033,1.7299055 0 1 1 3.388066,0 z"
id="path2985-2-9-1-5"
style="fill:#f73208;fill-opacity:1;stroke:#f73208;stroke-width:1.56599998;stroke-linejoin:round;stroke-miterlimit:4.9000001;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.52306283px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 8.6014883,11.263148 11.568004,8.4540331"
id="path3337"
inkscape:connector-curvature="0" />
<path
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.44801879px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="m 21.223272,23.725437 2.578632,-2.588379"
id="path3339"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -264,6 +264,8 @@ void VPattern::setCurrentData()
const VDataTool *vTool = tools.value(id);
*data = vTool->getData();
//Delete special variable if exist
data->RemoveVariable(currentLength);
qCDebug(vXML, "Data successfully updated.");
}
else
@ -3237,7 +3239,7 @@ void VPattern::ToolsCommonAttributes(const QDomElement &domElement, quint32 &id)
QRectF VPattern::ActiveDrawBoundingRect() const
{
// This check helps to find missed tools in the switch
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43, "Not all tools was used.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45, "Not all tools was used.");
QRectF rec;
@ -3254,6 +3256,8 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::LinePoint:
case Tool::AbstractSpline:
case Tool::Cut:
case Tool::Midpoint:// Same as Tool::AlongLine, but tool will never has such type
case Tool::ArcIntersectAxis:// Same as Tool::CurveIntersectAxis, but tool will never has such type
case Tool::LAST_ONE_DO_NOT_USE:
Q_UNREACHABLE();
break;

View File

@ -163,6 +163,7 @@ const QString angle2Spl_ = angle2_V + spl_;
const QString angle1SplPath = angle1_V + splPath;
const QString angle2SplPath = angle2_V + splPath;
const QString seg_ = QStringLiteral("Seg_");
const QString currentLength = QStringLiteral("CurrentLength");
const QStringList builInVariables = QStringList() << line_
<< angleLine_
@ -179,4 +180,5 @@ const QStringList builInVariables = QStringList() << line_
<< angle2Spl_
<< angle1SplPath
<< angle2SplPath
<< seg_;
<< seg_
<< currentLength;

View File

@ -170,6 +170,7 @@ extern const QString angle2Spl_;
extern const QString angle1SplPath;
extern const QString angle2SplPath;
extern const QString seg_;
extern const QString currentLength;
extern const QStringList builInVariables;

View File

@ -1242,7 +1242,7 @@ QStringList VAbstractPattern::ListPointExpressions() const
{
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagPoint);
@ -1313,7 +1313,7 @@ QStringList VAbstractPattern::ListArcExpressions() const
{
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagArc);
@ -1374,7 +1374,7 @@ QStringList VAbstractPattern::ListPathPointExpressions() const
{
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions;
const QDomNodeList list = elementsByTagName(AttrPathPoint);
@ -1440,7 +1440,7 @@ QStringList VAbstractPattern::ListOperationExpressions() const
{
// Check if new tool doesn't bring new attribute with a formula.
// If no just increment number
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 43);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 45);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagOperation);

View File

@ -96,6 +96,7 @@ enum class Tool : ToolVisHolderType
PointOfIntersectionCircles,
PointOfIntersectionCurves,
CurveIntersectAxis,
ArcIntersectAxis,
PointOfIntersection,
PointFromCircleAndTangent,
PointFromArcAndTangent,
@ -103,6 +104,7 @@ enum class Tool : ToolVisHolderType
UnionDetails,
Group,
Rotation,
Midpoint,
LAST_ONE_DO_NOT_USE //add new stuffs above this, this constant must be last and never used
};

View File

@ -420,6 +420,12 @@ void VContainer::AddCurveWithSegments(const QSharedPointer<VAbstractCubicBezierP
}
}
//---------------------------------------------------------------------------------------------------------------------
void VContainer::RemoveVariable(const QString &name)
{
d->variables.remove(name);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief AddObject add object to container

View File

@ -129,6 +129,7 @@ public:
template <typename T>
void AddVariable(const QString& name, T *var);
void RemoveVariable(const QString& name);
void UpdateGObject(quint32 id, VGObject* obj);
void UpdateDetail(quint32 id, const VDetail &detail);

View File

@ -380,6 +380,7 @@ void VTranslateVars::InitVariables()
variables.insert(angle2SplPath, translate("VTranslateVars", "Angle2SplPath",
"Do not add symbol _ to the end of the name"));
variables.insert(seg_, translate("VTranslateVars", "Seg_", "Segment. Left symbol _ in the name"));
variables.insert(currentLength, translate("VTranslateVars", "CurrentLength", "Do not add space between words"));
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -33,6 +33,7 @@
#include "../../../vwidgets/vmaingraphicsscene.h"
#include "../../../vpatterndb/vtranslatevars.h"
#include "../support/dialogeditwrongformula.h"
#include "../vgeometry/vpointf.h"
#include <QPushButton>
@ -44,7 +45,7 @@
*/
DialogAlongLine::DialogAlongLine(const VContainer *data, const quint32 &toolId, QWidget *parent)
:DialogTool(data, toolId, parent), ui(new Ui::DialogAlongLine),
formula(QString()), formulaBaseHeight(0)
formula(QString()), formulaBaseHeight(0), buildMidpoint(false)
{
ui->setupUi(this);
@ -93,7 +94,7 @@ void DialogAlongLine::FormulaTextChanged()
void DialogAlongLine::PointChanged()
{
QColor color = okColor;
if (getCurrentObjectId(ui->comboBoxFirstPoint) == getCurrentObjectId(ui->comboBoxSecondPoint))
if (GetFirstPointId() == GetSecondPointId())
{
flagError = false;
color = errorColor;
@ -103,6 +104,7 @@ void DialogAlongLine::PointChanged()
flagError = true;
color = okColor;
}
SetCurrentLength();
ChangeColor(ui->labelFirstPoint, color);
ChangeColor(ui->labelSecondPoint, color);
CheckState();
@ -137,6 +139,9 @@ void DialogAlongLine::DeployFormulaTextEdit()
//---------------------------------------------------------------------------------------------------------------------
DialogAlongLine::~DialogAlongLine()
{
VContainer *locData = const_cast<VContainer *> (data);
locData->RemoveVariable(currentLength);
DeleteVisualization<VisToolAlongLine>();
delete ui;
}
@ -173,6 +178,10 @@ void DialogAlongLine::ChosenObject(quint32 id, const SceneObject &type)
{
line->setObject2Id(id);
line->RefreshGeometry();
if (buildMidpoint)
{
SetFormula(currentLength + QLatin1Literal("/2"));
}
prepare = true;
this->setModal(true);
this->show();
@ -215,6 +224,20 @@ void DialogAlongLine::closeEvent(QCloseEvent *event)
DialogTool::closeEvent(event);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::SetCurrentLength()
{
const QSharedPointer<VPointF> p1 = data->GeometricObject<VPointF>(GetFirstPointId());
const QSharedPointer<VPointF> p2 = data->GeometricObject<VPointF>(GetSecondPointId());
VLengthLine *length = new VLengthLine(p1.data(), GetFirstPointId(), p2.data(),
GetSecondPointId(), *data->GetPatternUnit());
length->SetName(currentLength);
VContainer *locData = const_cast<VContainer *> (data);
locData->AddVariable(currentLength, length);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetSecondPointId set id second point of line
@ -229,6 +252,15 @@ void DialogAlongLine::SetSecondPointId(const quint32 &value)
line->setObject2Id(value);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogAlongLine::Build(const Tool &type)
{
if (type == Tool::Midpoint)
{
buildMidpoint = true;
}
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief SetFirstPointId set id first point of line

View File

@ -62,6 +62,8 @@ public:
quint32 GetSecondPointId() const;
void SetSecondPointId(const quint32 &value);
virtual void Build(const Tool &type) Q_DECL_OVERRIDE;
public slots:
virtual void ChosenObject(quint32 id, const SceneObject &type) Q_DECL_OVERRIDE;
/**
@ -93,6 +95,10 @@ private:
/** @brief formulaBaseHeight base height defined by dialogui */
int formulaBaseHeight;
bool buildMidpoint;
void SetCurrentLength();
};
#endif // DIALOGALONGLINE_H

View File

@ -919,6 +919,12 @@ void DialogTool::ShowDialog(bool click)
Q_UNUSED(click);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::Build(const Tool &type)
{
Q_UNUSED(type);
}
//---------------------------------------------------------------------------------------------------------------------
void DialogTool::SetAssociatedTool(VAbstractTool *tool)
{

View File

@ -69,6 +69,7 @@ public:
void SetAssociatedTool(VAbstractTool* tool);
virtual void ShowDialog(bool click);
virtual void Build(const Tool &type);
quint32 GetToolId() const;
void SetToolId(const quint32 &value);

View File

@ -250,6 +250,12 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
const QSharedPointer<VPointF> secondPoint = data->GeometricObject<VPointF>(secondPointId);
QLineF line = QLineF(*firstPoint, *secondPoint);
//Declare special variable "CurrentLength"
VLengthLine *length = new VLengthLine(firstPoint.data(), firstPointId, secondPoint.data(),
secondPointId, *data->GetPatternUnit());
length->SetName(currentLength);
data->AddVariable(currentLength, length);
line.setLength(qApp->toPixel(CheckFormula(_id, formula, data)));
quint32 id = _id;
@ -270,16 +276,18 @@ VToolAlongLine* VToolAlongLine::Create(const quint32 _id, const QString &pointNa
}
}
VDrawTool::AddRecord(id, Tool::AlongLine, doc);
VToolAlongLine *point = nullptr;
if (parse == Document::FullParse)
{
VToolAlongLine *point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine,
lineColor, typeCreation);
point = new VToolAlongLine(doc, data, id, formula, firstPointId, secondPointId, typeLine, lineColor,
typeCreation);
scene->addItem(point);
InitToolConnections(scene, point);
doc->AddTool(id, point);
doc->IncrementReferens(firstPoint->getIdTool());
doc->IncrementReferens(secondPoint->getIdTool());
return point;
}
return nullptr;
//Very important to delete it. Only this tool need this special variable.
data->RemoveVariable(currentLength);
return point;
}

View File

@ -651,6 +651,7 @@ void TST_MeasurementRegExp::CheckUnderlineExists() const
data.insert(angle1SplPath, false);
data.insert(angle2SplPath, false);
data.insert(seg_, true);
data.insert(currentLength, false);
//Catch case when new internal variable appears.
QCOMPARE(data.size(), builInVariables.size());