Moves the arrow tool from the toolbar to all the tabs in the toolbox as

discussed in https://groups.google.com/forum/#!topic/valentina-project-list/6RvYFlJLmMM

Thanks Benjamin Nauck for idea and the patch.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-06-28 20:42:04 +03:00
parent 79d63f49a6
commit 002619ad83
7 changed files with 354 additions and 116 deletions

View File

@ -124,7 +124,8 @@ MainWindow::MainWindow(QWidget *parent)
toolOptions(nullptr),
groupsWidget(nullptr),
detailsWidget(nullptr),
lock(nullptr)
lock(nullptr),
toolButtonPointerList()
{
for (int i = 0; i < MaxRecentFiles; ++i)
{
@ -1736,6 +1737,18 @@ void MainWindow::ToolBarTools()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::InitToolButtons()
{
toolButtonPointerList.append(ui->toolButtonPointerPoint);
toolButtonPointerList.append(ui->toolButtonPointerLine);
toolButtonPointerList.append(ui->toolButtonPointerCurve);
toolButtonPointerList.append(ui->toolButtonPointerArc);
toolButtonPointerList.append(ui->toolButtonPointerDetail);
toolButtonPointerList.append(ui->toolButtonPointerOperations);
for (auto pointer : toolButtonPointerList)
{
connect(pointer, &QToolButton::clicked, this, &MainWindow::ArrowTool);
}
connect(ui->toolButtonEndLine, &QToolButton::clicked, this, &MainWindow::ToolEndLine);
connect(ui->toolButtonLine, &QToolButton::clicked, this, &MainWindow::ToolLine);
connect(ui->toolButtonAlongLine, &QToolButton::clicked, this, &MainWindow::ToolAlongLine);
@ -1827,7 +1840,10 @@ void MainWindow::CancelTool()
switch ( currentTool )
{
case Tool::Arrow:
ui->actionArrowTool->setChecked(false);
for (auto pointer : toolButtonPointerList)
{
pointer->setChecked(false);
}
helpLabel->setText("");
ui->actionStopTool->setEnabled(true);
@ -1974,7 +1990,10 @@ void MainWindow::ArrowTool()
{
qCDebug(vMainWindow, "Arrow tool.");
CancelTool();
ui->actionArrowTool->setChecked(true);
for (auto pointer : toolButtonPointerList)
{
pointer->setChecked(true);
}
ui->actionStopTool->setEnabled(false);
currentTool = Tool::Arrow;
emit EnableItemMove(true);
@ -3161,6 +3180,12 @@ void MainWindow::SetEnableTool(bool enable)
ui->actionLast_tool->setEnabled(drawTools);
for (auto pointer : toolButtonPointerList)
{
pointer->setEnabled(drawTools || modelingTools);
pointer->setChecked(drawTools || modelingTools);
}
//Modeling Tools
ui->toolButtonUnionDetails->setEnabled(modelingTools);
@ -3444,7 +3469,10 @@ void MainWindow::LastUsedTool()
switch ( lastUsedTool )
{
case Tool::Arrow:
ui->actionArrowTool->setChecked(true);
for (auto pointer : toolButtonPointerList)
{
pointer->setChecked(true);
}
ArrowTool();
break;
case Tool::BasePoint:
@ -3985,7 +4013,6 @@ void MainWindow::WindowsLocale()
//---------------------------------------------------------------------------------------------------------------------
void MainWindow::ToolBarStyles()
{
ToolBarStyle(ui->toolBarArrows);
ToolBarStyle(ui->toolBarDraws);
ToolBarStyle(ui->toolBarOption);
ToolBarStyle(ui->toolBarStages);

View File

@ -50,6 +50,7 @@ class DialogTool;
class DialogHistory;
class VWidgetGroups;
class VWidgetDetails;
class QToolButton;
/**
* @brief The MainWindow class main windows.
@ -280,6 +281,8 @@ private:
VWidgetDetails *detailsWidget;
std::shared_ptr<VLockGuard<char>> lock;
QList<QToolButton*> toolButtonPointerList;
void SetDefaultHeight();
void SetDefaultSize();

View File

@ -48,15 +48,15 @@
<string>Tools</string>
</property>
<property name="currentIndex">
<number>0</number>
<number>4</number>
</property>
<widget class="QWidget" name="page">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>130</width>
<height>318</height>
<width>117</width>
<height>358</height>
</rect>
</property>
<property name="sizePolicy">
@ -82,32 +82,6 @@
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="2" column="0">
<widget class="QToolButton" name="toolButtonEndLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Point at distance and angle</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/segment.png</normaloff>:/toolicon/32x32/segment.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="2" column="1">
<widget class="QToolButton" name="toolButtonAlongLine">
<property name="enabled">
@ -368,6 +342,32 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerPoint">
<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="10" column="1">
<widget class="QToolButton" name="toolButtonMidpoint">
<property name="enabled">
@ -394,6 +394,32 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QToolButton" name="toolButtonEndLine">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Point at distance and angle</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/segment.png</normaloff>:/toolicon/32x32/segment.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">
@ -402,7 +428,7 @@
<x>0</x>
<y>0</y>
<width>130</width>
<height>58</height>
<height>110</height>
</rect>
</property>
<property name="sizePolicy">
@ -425,10 +451,33 @@
<string>Line</string>
</attribute>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerLine">
<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="2" column="0">
<widget class="QToolButton" name="toolButtonLine">
<property name="enabled">
<bool>false</bool>
@ -454,7 +503,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="2" column="1">
<widget class="QToolButton" name="toolButtonLineIntersect">
<property name="enabled">
<bool>false</bool>
@ -488,7 +537,7 @@
<x>0</x>
<y>0</y>
<width>130</width>
<height>196</height>
<height>248</height>
</rect>
</property>
<property name="sizePolicy">
@ -511,36 +560,7 @@
<string>Curve</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonSpline">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Simple curve</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/spline.png</normaloff>:/toolicon/32x32/spline.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">
<item row="1" column="1">
<widget class="QToolButton" name="toolButtonSplineCutPoint">
<property name="enabled">
<bool>false</bool>
@ -566,7 +586,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QToolButton" name="toolButtonCubicBezier">
<property name="enabled">
<bool>false</bool>
@ -592,7 +612,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QToolButton" name="toolButtonSplinePath">
<property name="enabled">
<bool>false</bool>
@ -618,7 +638,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QToolButton" name="toolButtonSplinePathCutPoint">
<property name="enabled">
<bool>false</bool>
@ -644,7 +664,30 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="4" column="1">
<widget class="QToolButton" name="toolButtonCubicBezierPath">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/cubic_bezier_path.png</normaloff>:/toolicon/32x32/cubic_bezier_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>
<item row="5" column="0">
<widget class="QToolButton" name="toolButtonIntersectionCurves">
<property name="enabled">
<bool>false</bool>
@ -670,7 +713,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="5" column="1">
<widget class="QToolButton" name="toolButtonCurveIntersectAxis">
<property name="enabled">
<bool>false</bool>
@ -696,17 +739,46 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QToolButton" name="toolButtonCubicBezierPath">
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerCurve">
<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="1" column="0">
<widget class="QToolButton" name="toolButtonSpline">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Simple curve</string>
</property>
<property name="text">
<string notr="true">...</string>
</property>
<property name="icon">
<iconset resource="share/resources/toolicon.qrc">
<normaloff>:/toolicon/32x32/cubic_bezier_path.png</normaloff>:/toolicon/32x32/cubic_bezier_path.png</iconset>
<normaloff>:/toolicon/32x32/spline.png</normaloff>:/toolicon/32x32/spline.png</iconset>
</property>
<property name="iconSize">
<size>
@ -727,7 +799,7 @@
<x>0</x>
<y>0</y>
<width>130</width>
<height>196</height>
<height>248</height>
</rect>
</property>
<property name="sizePolicy">
@ -750,10 +822,7 @@
<string>Arc</string>
</attribute>
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<item row="2" column="0">
<widget class="QToolButton" name="toolButtonArc">
<property name="enabled">
<bool>false</bool>
@ -779,7 +848,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="2" column="1">
<widget class="QToolButton" name="toolButtonArcCutPoint">
<property name="enabled">
<bool>false</bool>
@ -805,7 +874,7 @@
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QToolButton" name="toolButtonArcIntersectAxis">
<property name="enabled">
<bool>false</bool>
@ -831,7 +900,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QToolButton" name="toolButtonPointOfIntersectionArcs">
<property name="enabled">
<bool>false</bool>
@ -857,7 +926,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<item row="4" column="0">
<widget class="QToolButton" name="toolButtonPointOfIntersectionCircles">
<property name="enabled">
<bool>false</bool>
@ -883,7 +952,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="4" column="1">
<widget class="QToolButton" name="toolButtonPointFromCircleAndTangent">
<property name="enabled">
<bool>false</bool>
@ -909,7 +978,7 @@
</property>
</widget>
</item>
<item row="3" column="0">
<item row="5" column="0">
<widget class="QToolButton" name="toolButtonPointFromArcAndTangent">
<property name="enabled">
<bool>false</bool>
@ -935,7 +1004,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="5" column="1">
<widget class="QToolButton" name="toolButtonArcWithLength">
<property name="enabled">
<bool>false</bool>
@ -961,6 +1030,32 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerArc">
<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>
</layout>
</widget>
<widget class="QWidget" name="page_7">
@ -984,6 +1079,32 @@
</attribute>
<layout class="QFormLayout" name="formLayout_7">
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerOperations">
<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="1" column="0">
<widget class="QToolButton" name="toolButtonGroup">
<property name="enabled">
<bool>false</bool>
@ -1009,7 +1130,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QToolButton" name="toolButtonRotation">
<property name="enabled">
<bool>false</bool>
@ -1043,7 +1164,7 @@
<x>0</x>
<y>0</y>
<width>130</width>
<height>58</height>
<height>104</height>
</rect>
</property>
<property name="sizePolicy">
@ -1066,10 +1187,33 @@
<string>Detail</string>
</attribute>
<layout class="QFormLayout" name="formLayout_5">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QToolButton" name="toolButtonPointerDetail">
<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="1" column="0">
<widget class="QToolButton" name="toolButtonNewDetail">
<property name="enabled">
<bool>false</bool>
@ -1095,7 +1239,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="1" column="1">
<widget class="QToolButton" name="toolButtonUnionDetails">
<property name="enabled">
<bool>false</bool>
@ -1433,26 +1577,6 @@
</attribute>
<widget class="QWidget" name="dockWidgetContents_10"/>
</widget>
<widget class="QToolBar" name="toolBarArrows">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="windowTitle">
<string>Toolbar pointer</string>
</property>
<property name="toolButtonStyle">
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
<addaction name="actionArrowTool"/>
</widget>
<widget class="QDockWidget" name="dockWidgetLayoutPages">
<property name="features">
<set>QDockWidget::NoDockWidgetFeatures</set>

View File

@ -4,6 +4,7 @@
<file>icon/32x32/draw.png</file>
<file>icon/32x32/kontur.png</file>
<file>icon/32x32/arrow_cursor.png</file>
<file>icon/32x32/arrow_cursor@2x.png</file>
<file>icon/32x32/new_draw.png</file>
<file>icon/32x32/option_draw.png</file>
<file>icon/32x32/table.png</file>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 543 B

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 668 B

View File

@ -0,0 +1,83 @@
<?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"
width="32"
height="32"
viewBox="0 0 31.999999 31.999998"
id="svg3339"
version="1.1"
inkscape:version="0.91 r13725"
inkscape:export-filename="arrow_cursor@2x.png"
inkscape:export-xdpi="180"
inkscape:export-ydpi="180"
sodipodi:docname="arrow_cursor.svg">
<defs
id="defs3341" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="35.311144"
inkscape:cx="14.060175"
inkscape:cy="7.9609194"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
units="px"
inkscape:window-width="1680"
inkscape:window-height="1001"
inkscape:window-x="0"
inkscape:window-y="1"
inkscape:window-maximized="1"
inkscape:object-paths="true"
inkscape:snap-nodes="true"
inkscape:snap-others="false"
inkscape:object-nodes="true">
<inkscape:grid
type="xygrid"
id="grid4134"
originx="0"
originy="0" />
<inkscape:grid
type="xygrid"
id="grid4136"
originx="0.49999998"
originy="0.49999997"
dotted="true" />
</sodipodi:namedview>
<metadata
id="metadata3344">
<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></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(0,-1020.3622)">
<path
style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:0.99999988;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1"
d="m 8.499999,1043.8622 0,-22 15.999998,16 -7.499999,0 5.322588,10.6452 c -0.822589,1.3548 -2.335571,1.354 -3.322588,1.3548 l -5.5,-11 z"
id="path3369"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.6 KiB