Tool button connected to tool dialog.

--HG--
branch : feature
This commit is contained in:
Roman Telezhynskyi 2016-11-22 14:33:08 +02:00
parent f741e1387c
commit 6b89f43e87
17 changed files with 178 additions and 20 deletions

View File

@ -77,7 +77,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) == 49, "Not all tools was used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch.");
switch (item->type())
{
@ -210,7 +210,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) == 49, "Not all tools was used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch.");
switch (currentItem->type())
{
@ -354,7 +354,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) == 49, "Not all tools was used in switch.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used in switch.");
switch (currentItem->type())
{

View File

@ -208,7 +208,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
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) == 49, "Not all tools was used in history.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools was used in history.");
const QDomElement domElem = doc->elementById(tool.getId());
if (domElem.isElement() == false)
@ -392,6 +392,7 @@ QString DialogHistory::Record(const VToolRecord &tool)
case Tool::FlippingByLine:
case Tool::FlippingByAxis:
case Tool::Move:
case Tool::PiecePath:
return QString();
}
}

View File

@ -952,6 +952,14 @@ void MainWindow::ToolDetail(bool checked)
&MainWindow::ApplyDetailsDialog<VToolSeamAllowance>);
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolPiecePath(bool checked)
{
ToolSelectAllDrawObjects();
SetToolButton<DialogPiecePath>(checked, Tool::PiecePath, "://cursor/path_cursor.png", tr("Select path objects."),
&MainWindow::ClosedDialogPiecePath);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ClosedDialogDetail actions after closing DialogDetail.
@ -1104,6 +1112,19 @@ void MainWindow::ClosedDialogGroup(int result)
ArrowTool();
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ClosedDialogPiecePath(int result)
{
SCASSERT(dialogTool != nullptr);
if (result == QDialog::Accepted)
{
DialogPiecePath *dialog = qobject_cast<DialogPiecePath*>(dialogTool);
SCASSERT(dialog != nullptr);
}
ArrowTool();
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolCutArc handler tool cutArc.
@ -1671,6 +1692,7 @@ void MainWindow::ToolBarDraws()
});
}
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarTools()
{
/*First we will try use Standard Shortcuts from Qt, but because keypad "-" and "+" not the same keys like in main
@ -1717,6 +1739,9 @@ void MainWindow::InitToolButtons()
connect(pointer, &QToolButton::clicked, this, &MainWindow::ArrowTool);
}
// This check helps to find missed tools
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Check if all tools were connected.");
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
connect(ui->toolButtonAlongLine, &QToolButton::clicked, this, &MainWindow::ToolAlongLine);
@ -1731,6 +1756,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonCubicBezierPath, &QToolButton::clicked, this, &MainWindow::ToolCubicBezierPath);
connect(ui->toolButtonPointOfContact, &QToolButton::clicked, this, &MainWindow::ToolPointOfContact);
connect(ui->toolButtonNewDetail, &QToolButton::clicked, this, &MainWindow::ToolDetail);
connect(ui->toolButtonPiecePath, &QToolButton::clicked, this, &MainWindow::ToolPiecePath);
connect(ui->toolButtonHeight, &QToolButton::clicked, this, &MainWindow::ToolHeight);
connect(ui->toolButtonTriangle, &QToolButton::clicked, this, &MainWindow::ToolTriangle);
connect(ui->toolButtonPointOfIntersection, &QToolButton::clicked, this, &MainWindow::ToolPointOfIntersection);
@ -1786,7 +1812,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
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) == 49, "Not all tools was handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools was handled.");
qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool;
@ -1875,6 +1901,9 @@ void MainWindow::CancelTool()
case Tool::Piece:
ui->toolButtonNewDetail->setChecked(false);
break;
case Tool::PiecePath:
ui->toolButtonPiecePath->setChecked(false);
break;
case Tool::Height:
ui->toolButtonHeight->setChecked(false);
break;
@ -2987,7 +3016,7 @@ void MainWindow::SetEnableTool(bool enable)
}
// This check helps to find missed tools
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were handled.");
//Drawing Tools
ui->toolButtonEndLine->setEnabled(drawTools);
@ -3004,6 +3033,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonCubicBezierPath->setEnabled(drawTools);
ui->toolButtonPointOfContact->setEnabled(drawTools);
ui->toolButtonNewDetail->setEnabled(drawTools);
ui->toolButtonPiecePath->setEnabled(drawTools);
ui->toolButtonHeight->setEnabled(drawTools);
ui->toolButtonTriangle->setEnabled(drawTools);
ui->toolButtonPointOfIntersection->setEnabled(drawTools);
@ -3307,7 +3337,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
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) == 49, "Not all tools was handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were handled.");
if (currentTool == lastUsedTool)
{
@ -3401,6 +3431,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonNewDetail->setChecked(true);
ToolDetail(true);
break;
case Tool::PiecePath:
ui->toolButtonPiecePath->setChecked(true);
ToolPiecePath(true);
break;
case Tool::Height:
ui->toolButtonHeight->setChecked(true);
ToolHeight(true);

View File

@ -134,6 +134,7 @@ private slots:
void ToolCutSplinePath(bool checked);
void ToolPointOfContact(bool checked);
void ToolDetail(bool checked);
void ToolPiecePath(bool checked);
void ToolHeight(bool checked);
void ToolTriangle(bool checked);
void ToolPointOfIntersection(bool checked);
@ -167,6 +168,7 @@ private slots:
void ClosedDialogDetail(int result);
void ClosedDialogUnionDetails(int result);
void ClosedDialogGroup(int result);
void ClosedDialogPiecePath(int result);
void LoadIndividual();
void LoadStandard();

View File

@ -48,7 +48,7 @@
<string>Tools</string>
</property>
<property name="currentIndex">
<number>4</number>
<number>5</number>
</property>
<widget class="QWidget" name="page">
<property name="geometry">
@ -427,7 +427,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<width>130</width>
<height>110</height>
</rect>
</property>
@ -536,7 +536,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<width>130</width>
<height>248</height>
</rect>
</property>
@ -798,7 +798,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<width>130</width>
<height>248</height>
</rect>
</property>
@ -1241,8 +1241,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>117</width>
<height>104</height>
<width>130</width>
<height>150</height>
</rect>
</property>
<property name="sizePolicy">
@ -1343,6 +1343,32 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QToolButton" name="toolButtonPiecePath">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Piece path tool</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/path.png</normaloff>:/toolicon/32x32/path.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_6">
@ -2480,8 +2506,8 @@
</customwidget>
</customwidgets>
<resources>
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
<include location="share/resources/toolicon.qrc"/>
<include location="../../libs/vmisc/share/resources/icon.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -76,5 +76,7 @@
<file>cursor/flipping_axis_cursor@2x.png</file>
<file>cursor/move_cursor.png</file>
<file>cursor/move_cursor@2x.png</file>
<file>cursor/path_cursor.png</file>
<file>cursor/path_cursor@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@ -74,5 +74,7 @@
<file>toolicon/32x32/flipping_axis@2x.png</file>
<file>toolicon/32x32/move.png</file>
<file>toolicon/32x32/move@2x.png</file>
<file>toolicon/32x32/path.png</file>
<file>toolicon/32x32/path@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 752 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,85 @@
<?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="path.svg"
inkscape:export-filename="normal.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90">
<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="10.429825"
inkscape:cx="-10.695145"
inkscape:cy="17.373127"
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:#f70000;stroke-width:1.808;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 0.69867705,29.000338 18.91523895,0"
id="path4205"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
d="m 4.55558,29.025223 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
style="fill:none;fill-rule:evenodd;stroke:#f70000;stroke-width:1.79597759;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="m 18.613918,3.1640977 c 16.627356,3.2556205 16.092696,24.3053213 0,25.7434553"
id="path3385"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cc" />
<path
inkscape:connector-curvature="0"
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"
id="path5373"
d="m 20.178354,28.833465 a 1.8239208,1.9086996 0 0 1 -3.647841,0 1.8239208,1.9086996 0 1 1 3.647841,0 z" />
<path
inkscape:connector-curvature="0"
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"
id="path5373-7"
d="m 20.424424,3.1415223 a 1.8239208,1.9086996 0 0 1 -3.647841,0 1.8239208,1.9086996 0 1 1 3.647841,0 z" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@ -3478,7 +3478,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
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) == 49, "Not all tools was used.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50, "Not all tools were used.");
QRectF rec;
@ -3608,6 +3608,7 @@ QRectF VPattern::ActiveDrawBoundingRect() const
case Tool::NodeSpline:
case Tool::NodeSplinePath:
case Tool::Group:
case Tool::PiecePath:
break;
}
}

View File

@ -1422,7 +1422,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) == 49);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagPoint);
@ -1493,7 +1493,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) == 49);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagArc);
@ -1554,7 +1554,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) == 49);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50);
QStringList expressions;
const QDomNodeList list = elementsByTagName(AttrPathPoint);
@ -1620,7 +1620,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) == 49);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 50);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagOperation);

View File

@ -103,6 +103,7 @@ enum class Tool : ToolVisHolderType
PointOfContact,
Detail,
Piece,
PiecePath,
NodePoint,
NodeArc,
NodeSpline,
@ -170,7 +171,8 @@ enum class Vis : ToolVisHolderType
ToolFlippingByLine,
ToolFlippingByAxis,
ToolMove,
ToolPiece
ToolPiece,
ToolPiecePath
};
enum class VarType : char { Measurement, Increment, LineLength, CurveLength, CurveCLength, LineAngle, CurveAngle,

View File

@ -66,6 +66,7 @@
#include "tools/dialogflippingbyline.h"
#include "tools/dialogflippingbyaxis.h"
#include "tools/dialogmove.h"
#include "tools/dialogpiecepath.h"
#include "support/dialogeditwrongformula.h"
#include "support/dialogundo.h"

View File

@ -56,6 +56,8 @@ DialogPiecePath::DialogPiecePath(const VContainer *data, quint32 toolId, QWidget
ui->comboBoxType->setDisabled(true);
ui->comboBoxPiece->setDisabled(true);
}
show();//temporary
}
//---------------------------------------------------------------------------------------------------------------------