Added elliptical arc tool to MainWindow.

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-12-17 03:17:29 +02:00
parent a5f504a710
commit aa24976f9a
13 changed files with 118 additions and 7 deletions

View file

@ -874,6 +874,20 @@ void MainWindow::ToolArc(bool checked)
&MainWindow::ApplyDialog<VToolArc>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolEllipticalArc handler tool arc.
* @param checked true - button checked.
*/
void MainWindow::ToolEllipticalArc(bool checked)
{
ToolSelectPointByRelease();
SetToolButtonWithApply<DialogEllipticalArc>(checked, Tool::EllipticalArc, ":/cursor/el_arc_cursor.png",
tr("Select point of center of elliptical arc"),
&MainWindow::ClosedDialogWithApply<VToolEllipticalArc>,
&MainWindow::ApplyDialog<VToolEllipticalArc>);
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief ToolSplinePath handler tool splinePath.
@ -1698,6 +1712,7 @@ void MainWindow::InitToolButtons()
toolButtonPointerList.append(ui->toolButtonPointerArc);
toolButtonPointerList.append(ui->toolButtonPointerDetail);
toolButtonPointerList.append(ui->toolButtonPointerOperations);
toolButtonPointerList.append(ui->toolButtonPointerEllipticalArc);
for (auto pointer : toolButtonPointerList)
{
@ -1746,6 +1761,7 @@ void MainWindow::InitToolButtons()
connect(ui->toolButtonMove, &QToolButton::clicked, this, &MainWindow::ToolMove);
connect(ui->toolButtonMidpoint, &QToolButton::clicked, this, &MainWindow::ToolMidpoint);
connect(ui->toolButtonLayoutExportAs, &QToolButton::clicked, this, &MainWindow::ExportLayoutAs);
connect(ui->toolButtonEllipticalArc, &QToolButton::clicked, this, &MainWindow::ToolEllipticalArc);
}
//---------------------------------------------------------------------------------------------------------------------
@ -1773,7 +1789,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) == 48, "Not all tools was handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled.");
qCDebug(vMainWindow, "Canceling tool.");
delete dialogTool;
@ -1922,6 +1938,9 @@ void MainWindow::CancelTool()
case Tool::Move:
ui->toolButtonMove->setChecked(false);
break;
case Tool::EllipticalArc:
ui->toolButtonEllipticalArc->setChecked(false);
break;
}
// Crash: using CRTL+Z while using line tool.
@ -2972,7 +2991,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) == 48, "Not all tools were handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools were handled.");
//Drawing Tools
ui->toolButtonEndLine->setEnabled(drawTools);
@ -3011,6 +3030,7 @@ void MainWindow::SetEnableTool(bool enable)
ui->toolButtonFlippingByAxis->setEnabled(drawTools);
ui->toolButtonMove->setEnabled(drawTools);
ui->toolButtonMidpoint->setEnabled(drawTools);
ui->toolButtonEllipticalArc->setEnabled(drawTools);
ui->actionLast_tool->setEnabled(drawTools);
@ -3292,7 +3312,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) == 48, "Not all tools was handled.");
Q_STATIC_ASSERT_X(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49, "Not all tools was handled.");
if (currentTool == lastUsedTool)
{
@ -3470,6 +3490,10 @@ void MainWindow::LastUsedTool()
ui->toolButtonMove->setChecked(true);
ToolMove(true);
break;
case Tool::EllipticalArc:
ui->toolButtonEllipticalArc->setChecked(true);
ToolEllipticalArc(true);
break;
}
}

View file

@ -129,6 +129,7 @@ private slots:
void ToolCubicBezier(bool checked);
void ToolCutSpline(bool checked);
void ToolArc(bool checked);
void ToolEllipticalArc(bool checked);
void ToolSplinePath(bool checked);
void ToolCubicBezierPath(bool checked);
void ToolCutSplinePath(bool checked);

View file

@ -1058,6 +1058,86 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="page_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<height>56</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Tools for creating elliptical arcs.</string>
</property>
<attribute name="icon">
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
<normaloff>:/icon/16x16/toolsectionelarc@2x.png</normaloff>:/icon/16x16/toolsectionelarc@2x.png</iconset>
</attribute>
<attribute name="label">
<string>Elliptical Arc</string>
</attribute>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerEllipticalArc">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Tool pointer</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="../../libs/vmisc/share/resources/icon.qrc">
<normaloff>:/icon/32x32/arrow_cursor.png</normaloff>:/icon/32x32/arrow_cursor.png</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="toolButtonEllipticalArc">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Arc</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/el_arc.png</normaloff>:/toolicon/32x32/el_arc.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_7">
<property name="geometry">
<rect>

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/el_arc_cursor.png</file>
<file>cursor/el_arc_cursor@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 964 B

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/el_arc.png</file>
<file>toolicon/32x32/el_arc@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 579 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

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) == 48);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
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) == 48);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
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) == 48);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
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) == 48);
Q_STATIC_ASSERT(static_cast<int>(Tool::LAST_ONE_DO_NOT_USE) == 49);
QStringList expressions;
const QDomNodeList list = elementsByTagName(TagOperation);

View file

@ -64,5 +64,7 @@
<file>icon/16x16/allow_detail@2x.png</file>
<file>icon/16x16/forbid_detail.png</file>
<file>icon/16x16/forbid_detail@2x.png</file>
<file>icon/16x16/toolsectionelarc.png</file>
<file>icon/16x16/toolsectionelarc@2x.png</file>
</qresource>
</RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 305 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B