mainstatusbar, graphwidget shall provide public slot for each functionality

master
Denes Matetelki 14 years ago
parent 919ec7fbe5
commit f2f470337a

@ -348,9 +348,6 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
// insert new node // insert new node
case Qt::Key_Insert: case Qt::Key_Insert:
insertNode(); insertNode();
contentChanged();
if (m_showingNodeNumbers)
showNodeNumbers();
break; break;
@ -400,38 +397,7 @@ void GraphWidget::keyPressEvent(QKeyEvent *event)
// delete node // delete node
case Qt::Key_Delete: case Qt::Key_Delete:
{ {
removeNode();
if (m_activeNode == m_nodeList.first())
{
m_parent->statusBarMsg(tr("Base node cannot be deleted."));
break;
}
QList <Node *> nodeList;
if (event->modifiers() == Qt::AltModifier)
{
nodeList = m_activeNode->subtree();
}
else
{
nodeList.push_back(m_activeNode);
}
foreach(Node *node, nodeList)
{
if (m_hintNode==node)
m_hintNode=0;
m_nodeList.removeAll(node);
delete node;
}
m_activeNode = 0;
contentChanged();
if (m_showingNodeNumbers)
showNodeNumbers();
break; break;
} }
// add edge to active node // add edge to active node
@ -563,6 +529,12 @@ void GraphWidget::setActiveNode(Node *node)
void GraphWidget::insertNode() void GraphWidget::insertNode()
{ {
if (!m_activeNode)
{
m_parent->statusBarMsg(tr("No active node."));
return;
}
double angle(m_activeNode->calculateBiggestAngle()); double angle(m_activeNode->calculateBiggestAngle());
qreal length(100); qreal length(100);
@ -583,6 +555,50 @@ void GraphWidget::insertNode()
setActiveNode(node); setActiveNode(node);
setActiveNodeEditable(); setActiveNodeEditable();
contentChanged();
if (m_showingNodeNumbers)
showNodeNumbers();
}
void GraphWidget::removeNode()
{
if (!m_activeNode)
{
m_parent->statusBarMsg(tr("No active node."));
return;
}
if (m_activeNode == m_nodeList.first())
{
m_parent->statusBarMsg(tr("Base node cannot be deleted."));
return;
}
QList <Node *> nodeList;
if (QApplication::keyboardModifiers() & Qt::AltModifier)
{
nodeList = m_activeNode->subtree();
}
else
{
nodeList.push_back(m_activeNode);
}
foreach(Node *node, nodeList)
{
if (m_hintNode==node)
m_hintNode=0;
m_nodeList.removeAll(node);
delete node;
}
m_activeNode = 0;
contentChanged();
if (m_showingNodeNumbers)
showNodeNumbers();
} }
void GraphWidget::showingAllNodeNumbers(const bool &show) void GraphWidget::showingAllNodeNumbers(const bool &show)

@ -18,7 +18,6 @@ public:
GraphWidget(MainWindow *parent = 0); GraphWidget(MainWindow *parent = 0);
void setActiveNode(Node *node); void setActiveNode(Node *node);
void insertNode();
void setActiveNodeEditable(); void setActiveNodeEditable();
void nodeSelected(Node *node); void nodeSelected(Node *node);
void nodeMoved(QGraphicsSceneMouseEvent *event); void nodeMoved(QGraphicsSceneMouseEvent *event);
@ -35,6 +34,11 @@ public:
void insertPicture(const QString &picture); void insertPicture(const QString &picture);
public slots:
void insertNode();
void removeNode();
protected: protected:
void keyPressEvent(QKeyEvent *event); void keyPressEvent(QKeyEvent *event);

@ -0,0 +1,436 @@
<?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:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg6431"
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
sodipodi:docname="list-add.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs6433">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective70" />
<linearGradient
inkscape:collect="always"
id="linearGradient2091">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2093" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop2095" />
</linearGradient>
<linearGradient
id="linearGradient7916">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop7918" />
<stop
style="stop-color:#ffffff;stop-opacity:0.34020618;"
offset="1.0000000"
id="stop7920" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient8662">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop8664" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop8666" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient8662"
id="radialGradient1503"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.536723,-1.018989e-13,16.87306)"
cx="24.837126"
cy="36.421127"
fx="24.837126"
fy="36.421127"
r="15.644737" />
<linearGradient
inkscape:collect="always"
id="linearGradient2847">
<stop
style="stop-color:#3465a4;stop-opacity:1;"
offset="0"
id="stop2849" />
<stop
style="stop-color:#3465a4;stop-opacity:0;"
offset="1"
id="stop2851" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2847"
id="linearGradient1488"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1.000000,0.000000,0.000000,-1.000000,-1.242480,40.08170)"
x1="37.128052"
y1="29.729605"
x2="37.065414"
y2="26.194071" />
<linearGradient
id="linearGradient2831">
<stop
style="stop-color:#3465a4;stop-opacity:1;"
offset="0"
id="stop2833" />
<stop
id="stop2855"
offset="0.33333334"
style="stop-color:#5b86be;stop-opacity:1;" />
<stop
style="stop-color:#83a8d8;stop-opacity:0;"
offset="1"
id="stop2835" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2831"
id="linearGradient1486"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48.30498,-6.043298)"
x1="13.478554"
y1="10.612206"
x2="15.419417"
y2="19.115122" />
<linearGradient
id="linearGradient2380">
<stop
style="stop-color:#b9cfe7;stop-opacity:1"
offset="0"
id="stop2382" />
<stop
style="stop-color:#729fcf;stop-opacity:1"
offset="1"
id="stop2384" />
</linearGradient>
<linearGradient
id="linearGradient2682">
<stop
style="stop-color:#3977c3;stop-opacity:1;"
offset="0"
id="stop2684" />
<stop
style="stop-color:#89aedc;stop-opacity:0;"
offset="1"
id="stop2686" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2682"
id="linearGradient2688"
x1="36.713837"
y1="31.455952"
x2="37.124462"
y2="24.842253"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48.77039,-5.765705)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2690">
<stop
style="stop-color:#c4d7eb;stop-opacity:1;"
offset="0"
id="stop2692" />
<stop
style="stop-color:#c4d7eb;stop-opacity:0;"
offset="1"
id="stop2694" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2690"
id="linearGradient2696"
x1="32.647972"
y1="30.748846"
x2="37.124462"
y2="24.842253"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48.77039,-5.765705)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2871">
<stop
style="stop-color:#3465a4;stop-opacity:1;"
offset="0"
id="stop2873" />
<stop
style="stop-color:#3465a4;stop-opacity:1"
offset="1"
id="stop2875" />
</linearGradient>
<linearGradient
id="linearGradient2402">
<stop
style="stop-color:#729fcf;stop-opacity:1;"
offset="0"
id="stop2404" />
<stop
style="stop-color:#528ac5;stop-opacity:1;"
offset="1"
id="stop2406" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2797"
id="linearGradient1493"
gradientUnits="userSpaceOnUse"
x1="5.9649176"
y1="26.048164"
x2="52.854097"
y2="26.048164" />
<linearGradient
inkscape:collect="always"
id="linearGradient2797">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2799" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop2801" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2797"
id="linearGradient1491"
gradientUnits="userSpaceOnUse"
x1="5.9649176"
y1="26.048164"
x2="52.854097"
y2="26.048164" />
<linearGradient
inkscape:collect="always"
id="linearGradient7179">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop7181" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop7183" />
</linearGradient>
<linearGradient
id="linearGradient2316">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2318" />
<stop
style="stop-color:#ffffff;stop-opacity:0.65979379;"
offset="1"
id="stop2320" />
</linearGradient>
<linearGradient
id="linearGradient1322">
<stop
id="stop1324"
offset="0.0000000"
style="stop-color:#729fcf" />
<stop
id="stop1326"
offset="1.0000000"
style="stop-color:#5187d6;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1322"
id="linearGradient4975"
x1="34.892849"
y1="36.422989"
x2="45.918697"
y2="48.547989"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-18.01785,-13.57119)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7179"
id="linearGradient7185"
x1="13.435029"
y1="13.604306"
x2="22.374878"
y2="23.554308"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7179"
id="linearGradient7189"
gradientUnits="userSpaceOnUse"
x1="13.435029"
y1="13.604306"
x2="22.374878"
y2="23.554308"
gradientTransform="matrix(-1.000000,0.000000,0.000000,-1.000000,47.93934,50.02474)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2380"
id="linearGradient7180"
gradientUnits="userSpaceOnUse"
x1="62.513836"
y1="36.061237"
x2="15.984863"
y2="20.60858" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient7182"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2402"
id="linearGradient7184"
gradientUnits="userSpaceOnUse"
x1="18.935766"
y1="23.667896"
x2="53.588622"
y2="26.649362" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient7186"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7916"
id="linearGradient7922"
x1="16.874998"
y1="22.851799"
x2="27.900846"
y2="34.976799"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2091"
id="radialGradient2097"
cx="23.070683"
cy="35.127438"
fx="23.070683"
fy="35.127438"
r="10.319340"
gradientTransform="matrix(0.914812,1.265023e-2,-8.21502e-3,0.213562,2.253914,27.18889)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.15686275"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="-123.56934"
inkscape:cy="0.031886897"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1280"
inkscape:window-height="818"
inkscape:window-x="0"
inkscape:window-y="30"
showguides="true"
inkscape:guide-bbox="true"
inkscape:showpageshadow="false" />
<metadata
id="metadata6436">
<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>Add</dc:title>
<dc:date>2006-01-04</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Andreas Nilsson</dc:title>
</cc:Agent>
</dc:creator>
<dc:source>http://tango-project.org</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>add</rdf:li>
<rdf:li>plus</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
sodipodi:type="arc"
style="opacity:0.10824742;fill:url(#radialGradient2097);fill-opacity:1;stroke:none;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
id="path1361"
sodipodi:cx="22.958872"
sodipodi:cy="34.94062"
sodipodi:rx="10.31934"
sodipodi:ry="2.320194"
d="M 33.278212 34.94062 A 10.31934 2.320194 0 1 1 12.639532,34.94062 A 10.31934 2.320194 0 1 1 33.278212 34.94062 z"
transform="matrix(1.550487,0,0,1.978714,-12.4813,-32.49103)" />
<path
style="font-size:59.901077px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;fill:#75a1d0;fill-opacity:1.0000000;stroke:#3465a4;stroke-width:1.0000004px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
d="M 27.514356,37.542682 L 27.514356,28.515722 L 37.492820,28.475543 L 37.492820,21.480219 L 27.523285,21.480219 L 27.514356,11.520049 L 20.498082,11.531210 L 20.502546,21.462362 L 10.512920,21.536022 L 10.477206,28.504561 L 20.511475,28.475543 L 20.518171,37.515896 L 27.514356,37.542682 z "
id="text1314"
sodipodi:nodetypes="ccccccccccccc" />
<path
style="font-size:59.901077px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;opacity:0.40860215;fill:url(#linearGradient4975);fill-opacity:1.0000000;stroke:url(#linearGradient7922);stroke-width:1.0000006px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
d="M 26.498702,36.533920 L 26.498702,27.499738 L 36.501304,27.499738 L 36.494607,22.475309 L 26.507630,22.475309 L 26.507630,12.480335 L 21.512796,12.498193 L 21.521725,22.475309 L 11.495536,22.493166 L 11.468750,27.466256 L 21.533143,27.475185 L 21.519750,36.502670 L 26.498702,36.533920 z "
id="path7076"
sodipodi:nodetypes="ccccccccccccc" />
<path
style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;opacity:0.31182796"
d="M 11.000000,25.000000 C 11.000000,26.937500 36.984375,24.031250 36.984375,24.968750 L 36.984375,21.968750 L 27.000000,22.000000 L 27.000000,12.034772 L 21.000000,12.034772 L 21.000000,22.000000 L 11.000000,22.000000 L 11.000000,25.000000 z "
id="path7914"
sodipodi:nodetypes="ccccccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

@ -0,0 +1,424 @@
<?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:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="48px"
height="48px"
id="svg6431"
sodipodi:version="0.32"
inkscape:version="0.46"
sodipodi:docbase="/home/jimmac/src/cvs/tango-icon-theme/scalable/actions"
sodipodi:docname="list-remove.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape">
<defs
id="defs6433">
<inkscape:perspective
sodipodi:type="inkscape:persp3d"
inkscape:vp_x="0 : 24 : 1"
inkscape:vp_y="0 : 1000 : 0"
inkscape:vp_z="48 : 24 : 1"
inkscape:persp3d-origin="24 : 16 : 1"
id="perspective69" />
<linearGradient
inkscape:collect="always"
id="linearGradient2091">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2093" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop2095" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient2091"
id="radialGradient2097"
cx="23.070683"
cy="35.127438"
fx="23.070683"
fy="35.127438"
r="10.319340"
gradientTransform="matrix(0.914812,1.265023e-2,-8.21502e-3,0.213562,2.253914,27.18889)"
gradientUnits="userSpaceOnUse" />
<linearGradient
id="linearGradient7916">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop7918" />
<stop
style="stop-color:#ffffff;stop-opacity:0.34020618;"
offset="1.0000000"
id="stop7920" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient8662">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop8664" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop8666" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient8662"
id="radialGradient1503"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.000000,0.000000,0.000000,0.536723,-1.018989e-13,16.87306)"
cx="24.837126"
cy="36.421127"
fx="24.837126"
fy="36.421127"
r="15.644737" />
<linearGradient
inkscape:collect="always"
id="linearGradient2847">
<stop
style="stop-color:#3465a4;stop-opacity:1;"
offset="0"
id="stop2849" />
<stop
style="stop-color:#3465a4;stop-opacity:0;"
offset="1"
id="stop2851" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2847"
id="linearGradient1488"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(-1.000000,0.000000,0.000000,-1.000000,-1.242480,40.08170)"
x1="37.128052"
y1="29.729605"
x2="37.065414"
y2="26.194071" />
<linearGradient
id="linearGradient2831">
<stop
style="stop-color:#3465a4;stop-opacity:1;"
offset="0"
id="stop2833" />
<stop
id="stop2855"
offset="0.33333334"
style="stop-color:#5b86be;stop-opacity:1;" />
<stop
style="stop-color:#83a8d8;stop-opacity:0;"
offset="1"
id="stop2835" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2831"
id="linearGradient1486"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48.30498,-6.043298)"
x1="13.478554"
y1="10.612206"
x2="15.419417"
y2="19.115122" />
<linearGradient
id="linearGradient2380">
<stop
style="stop-color:#b9cfe7;stop-opacity:1"
offset="0"
id="stop2382" />
<stop
style="stop-color:#729fcf;stop-opacity:1"
offset="1"
id="stop2384" />
</linearGradient>
<linearGradient
id="linearGradient2682">
<stop
style="stop-color:#3977c3;stop-opacity:1;"
offset="0"
id="stop2684" />
<stop
style="stop-color:#89aedc;stop-opacity:0;"
offset="1"
id="stop2686" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2682"
id="linearGradient2688"
x1="36.713837"
y1="31.455952"
x2="37.124462"
y2="24.842253"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48.77039,-5.765705)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2690">
<stop
style="stop-color:#c4d7eb;stop-opacity:1;"
offset="0"
id="stop2692" />
<stop
style="stop-color:#c4d7eb;stop-opacity:0;"
offset="1"
id="stop2694" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2690"
id="linearGradient2696"
x1="32.647972"
y1="30.748846"
x2="37.124462"
y2="24.842253"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-48.77039,-5.765705)" />
<linearGradient
inkscape:collect="always"
id="linearGradient2871">
<stop
style="stop-color:#3465a4;stop-opacity:1;"
offset="0"
id="stop2873" />
<stop
style="stop-color:#3465a4;stop-opacity:1"
offset="1"
id="stop2875" />
</linearGradient>
<linearGradient
id="linearGradient2402">
<stop
style="stop-color:#729fcf;stop-opacity:1;"
offset="0"
id="stop2404" />
<stop
style="stop-color:#528ac5;stop-opacity:1;"
offset="1"
id="stop2406" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2797"
id="linearGradient1493"
gradientUnits="userSpaceOnUse"
x1="5.9649176"
y1="26.048164"
x2="52.854097"
y2="26.048164" />
<linearGradient
inkscape:collect="always"
id="linearGradient2797">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop2799" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop2801" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2797"
id="linearGradient1491"
gradientUnits="userSpaceOnUse"
x1="5.9649176"
y1="26.048164"
x2="52.854097"
y2="26.048164" />
<linearGradient
inkscape:collect="always"
id="linearGradient7179">
<stop
style="stop-color:#ffffff;stop-opacity:1;"
offset="0"
id="stop7181" />
<stop
style="stop-color:#ffffff;stop-opacity:0;"
offset="1"
id="stop7183" />
</linearGradient>
<linearGradient
id="linearGradient2316">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop2318" />
<stop
style="stop-color:#ffffff;stop-opacity:0.65979379;"
offset="1"
id="stop2320" />
</linearGradient>
<linearGradient
id="linearGradient1322">
<stop
id="stop1324"
offset="0.0000000"
style="stop-color:#729fcf" />
<stop
id="stop1326"
offset="1.0000000"
style="stop-color:#5187d6;stop-opacity:1.0000000;" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient1322"
id="linearGradient4975"
x1="34.892849"
y1="36.422989"
x2="45.918697"
y2="48.547989"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(-18.01785,-13.57119)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7179"
id="linearGradient7185"
x1="13.435029"
y1="13.604306"
x2="22.374878"
y2="23.554308"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7179"
id="linearGradient7189"
gradientUnits="userSpaceOnUse"
x1="13.435029"
y1="13.604306"
x2="22.374878"
y2="23.554308"
gradientTransform="matrix(-1.000000,0.000000,0.000000,-1.000000,47.93934,50.02474)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2380"
id="linearGradient7180"
gradientUnits="userSpaceOnUse"
x1="62.513836"
y1="36.061237"
x2="15.984863"
y2="20.60858" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient7182"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2402"
id="linearGradient7184"
gradientUnits="userSpaceOnUse"
x1="18.935766"
y1="23.667896"
x2="53.588622"
y2="26.649362" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2871"
id="linearGradient7186"
gradientUnits="userSpaceOnUse"
x1="46.834816"
y1="45.264122"
x2="45.380436"
y2="50.939667" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient7916"
id="linearGradient7922"
x1="16.874998"
y1="22.851799"
x2="27.900846"
y2="34.976799"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="0.10980392"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1"
inkscape:cx="-123.27226"
inkscape:cy="26.474252"
inkscape:current-layer="layer1"
showgrid="false"
inkscape:grid-bbox="true"
inkscape:document-units="px"
inkscape:window-width="1280"
inkscape:window-height="818"
inkscape:window-x="0"
inkscape:window-y="30"
inkscape:showpageshadow="false" />
<metadata
id="metadata6436">
<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>Remove</dc:title>
<dc:date>2006-01-04</dc:date>
<dc:creator>
<cc:Agent>
<dc:title>Andreas Nilsson</dc:title>
</cc:Agent>
</dc:creator>
<dc:source>http://tango-project.org</dc:source>
<dc:subject>
<rdf:Bag>
<rdf:li>remove</rdf:li>
<rdf:li>delete</rdf:li>
</rdf:Bag>
</dc:subject>
<cc:license
rdf:resource="http://creativecommons.org/licenses/publicdomain/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/publicdomain/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
</cc:License>
</rdf:RDF>
</metadata>
<g
id="layer1"
inkscape:label="Layer 1"
inkscape:groupmode="layer">
<path
style="font-size:59.901077px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;fill:#75a1d0;fill-opacity:1.0000000;stroke:#3465a4;stroke-width:1.0000004px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
d="M 27.514356,28.359472 L 39.633445,28.475543 L 39.633445,21.480219 L 27.523285,21.480219 L 20.502546,21.462362 L 8.5441705,21.489147 L 8.5084565,28.457686 L 20.511475,28.475543 L 27.514356,28.359472 z "
id="text1314"
sodipodi:nodetypes="ccccccccc" />
<path
style="font-size:59.901077px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125.00000%;writing-mode:lr-tb;text-anchor:start;opacity:0.40860215;fill:url(#linearGradient4975);fill-opacity:1.0000000;stroke:url(#linearGradient7922);stroke-width:1.0000006px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;font-family:Bitstream Vera Sans"
d="M 38.579429,27.484113 L 38.588357,22.475309 L 9.5267863,22.493166 L 9.5000003,27.466256 L 38.579429,27.484113 z "
id="path7076"
sodipodi:nodetypes="ccccc" />
<path
style="fill:#ffffff;fill-opacity:1.0000000;fill-rule:evenodd;stroke:none;stroke-width:1.0000000px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1.0000000;opacity:0.31182796"
d="M 9.0000000,25.000000 C 9.0000000,26.937500 39.125000,24.062500 39.125000,25.000000 L 39.125000,22.000000 L 9.0000000,22.000000 L 9.0000000,25.000000 z "
id="path7914"
sodipodi:nodetypes="ccccc" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

@ -41,6 +41,56 @@ MainWindow::MainWindow(QWidget *parent) :
// why can't I do this with qtcreator? // why can't I do this with qtcreator?
/// @bug or a feature? no underline here /// @bug or a feature? no underline here
m_zoomIn = new QAction(tr("Zoom in (+)"), this);
m_zoomOut = new QAction(tr("Zoom out (+)"), this);
m_addNode = new QAction(tr("Add node (ins)"), this);
connect(m_addNode, SIGNAL(activated()), m_graphicsView, SLOT(insertNode()));
m_delNode = new QAction(tr("Del node (del)"), this);
connect(m_delNode, SIGNAL(activated()), m_graphicsView, SLOT(removeNode()));
m_editNode = new QAction(tr("Edit node (F2)"), this);
m_scaleUpNode = new QAction(tr("ScaleUp Node (Ctrl +)"), this);
m_scaleDownNode = new QAction(tr("ScaleDown Node (Ctrl -)"), this);
m_nodeColor = new QAction(tr("Node color (c)"), this);
m_nodeTextColor = new QAction(tr("Node textcolor (t)"), this);
m_addEdge = new QAction(tr("Add edge (a)"), this);
m_delEdge = new QAction(tr("Del edge (d)"), this);
m_moveNode = new QAction(tr("Move node (Ctrl cursor)"), this);
m_moveNode->setDisabled(true);
m_subtree = new QAction(tr("Apply on subtree (Alt)"), this);
m_subtree->setDisabled(true);
m_hintMode = new QAction(tr("Hint mode (f)"), this);
m_showMainToolbar = new QAction(tr("Main toolbar (Ctrl m)"), this);
m_showMainToolbar->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
connect(m_showMainToolbar, SIGNAL(activated()), this, SLOT(showMainToolbar()));
m_showStatusIconToolbar = new QAction(tr("Status icons (Ctrl i)"), this);
m_ui->mainToolBar->addAction(m_addNode);
m_ui->mainToolBar->addAction(m_delNode);
m_ui->mainToolBar->addAction(m_editNode);
m_ui->mainToolBar->addAction(m_scaleUpNode);
m_ui->mainToolBar->addAction(m_scaleDownNode);
m_ui->mainToolBar->addAction(m_nodeColor);
m_ui->mainToolBar->addAction(m_nodeTextColor);
m_ui->mainToolBar->addAction(m_addEdge);
m_ui->mainToolBar->addAction(m_delEdge);
m_ui->mainToolBar->addSeparator();
m_ui->mainToolBar->addAction(m_zoomIn);
m_ui->mainToolBar->addAction(m_zoomOut);
m_ui->mainToolBar->addAction(m_hintMode);
m_ui->mainToolBar->addAction(m_moveNode);
m_ui->mainToolBar->addAction(m_subtree);
m_ui->mainToolBar->addAction(m_showMainToolbar);
m_ui->mainToolBar->addAction(m_showStatusIconToolbar);
m_ui->mainToolBar->hide();
m_doIt = new QAction(QIcon(":/applications-system.svg"), "&Do", this); m_doIt = new QAction(QIcon(":/applications-system.svg"), "&Do", this);
m_doIt->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D)); m_doIt->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
connect(m_doIt, SIGNAL(activated()), this, SLOT(insertPicture())); connect(m_doIt, SIGNAL(activated()), this, SLOT(insertPicture()));
@ -57,9 +107,8 @@ MainWindow::MainWindow(QWidget *parent) :
m_blocked->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B)); m_blocked->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_B));
connect(m_blocked, SIGNAL(activated()), this, SLOT(insertPicture())); connect(m_blocked, SIGNAL(activated()), this, SLOT(insertPicture()));
m_question = new QAction(QIcon(":/help-browser.svg"), tr("&What?"), this); m_question = new QAction(QIcon(":/help-browser.svg"), tr("&How?"), this);
/// @todo come up with some shortcut m_question->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_H));
// m_question->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_W));
connect(m_question, SIGNAL(activated()), this, SLOT(insertPicture())); connect(m_question, SIGNAL(activated()), this, SLOT(insertPicture()));
m_postpone = new QAction(QIcon(":/x-office-calendar.svg"), tr("&Postpone"), this); m_postpone = new QAction(QIcon(":/x-office-calendar.svg"), tr("&Postpone"), this);
@ -74,16 +123,16 @@ MainWindow::MainWindow(QWidget *parent) :
m_maybe->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M)); m_maybe->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_M));
connect(m_maybe, SIGNAL(activated()), this, SLOT(insertPicture())); connect(m_maybe, SIGNAL(activated()), this, SLOT(insertPicture()));
m_ui->mainToolBar->addAction(m_doIt); m_ui->statusIcons_toolBar->addAction(m_doIt);
m_ui->mainToolBar->addAction(m_trash); m_ui->statusIcons_toolBar->addAction(m_trash);
m_ui->mainToolBar->addAction(m_info); m_ui->statusIcons_toolBar->addAction(m_info);
m_ui->mainToolBar->addAction(m_blocked); m_ui->statusIcons_toolBar->addAction(m_blocked);
m_ui->mainToolBar->addAction(m_question); m_ui->statusIcons_toolBar->addAction(m_question);
m_ui->mainToolBar->addAction(m_postpone); m_ui->statusIcons_toolBar->addAction(m_postpone);
m_ui->mainToolBar->addAction(m_delegate); m_ui->statusIcons_toolBar->addAction(m_delegate);
m_ui->mainToolBar->addAction(m_maybe); m_ui->statusIcons_toolBar->addAction(m_maybe);
m_ui->statusIcons_toolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
m_ui->mainToolBar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); m_ui->statusIcons_toolBar->hide();
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
@ -128,6 +177,8 @@ void MainWindow::newFile()
setTitle(m_fileName); setTitle(m_fileName);
m_graphicsView->setFocus(); m_graphicsView->setFocus();
showMainToolbar();
} }
void MainWindow::openFile(const QString &fileName) void MainWindow::openFile(const QString &fileName)
@ -165,6 +216,7 @@ void MainWindow::openFile(const QString &fileName)
m_ui->actionClose->setEnabled(true); m_ui->actionClose->setEnabled(true);
contentChanged(false); contentChanged(false);
setTitle(m_fileName); setTitle(m_fileName);
showMainToolbar();
} }
void MainWindow::saveFile() void MainWindow::saveFile()
@ -238,6 +290,7 @@ bool MainWindow::closeFile()
m_contentChanged = false; m_contentChanged = false;
setTitle(""); setTitle("");
m_graphicsView->closeScene(); m_graphicsView->closeScene();
showMainToolbar(false);
return true; return true;
} }
@ -381,11 +434,58 @@ void MainWindow::insertPicture()
} }
} }
void MainWindow::addNode() { }
void MainWindow::delNode() { }
void MainWindow::editNode() { }
void MainWindow::scaleUpNode() { }
void MainWindow::scaleDownNode() { }
void MainWindow::nodeColor() { }
void MainWindow::nodeTextColor() { }
void MainWindow::addEdge() { }
void MainWindow::delEdge() { }
void MainWindow::zoomIn() { }
void MainWindow::zoomOut() { }
void MainWindow::hintMode() { }
void MainWindow::showMainToolbar(const bool &show)
{
m_ui->mainToolBar->setVisible(show ?
!m_ui->mainToolBar->isVisible() :
false);
}
void MainWindow::showStatusIconToolbar(const bool &show)
{
m_ui->statusIcons_toolBar->setVisible(
show ?
!m_ui->statusIcons_toolBar->isVisible() :
false);
}
void MainWindow::closeEvent(QCloseEvent * event) void MainWindow::closeEvent(QCloseEvent * event)
{ {
m_contentChanged && !closeFile() ? event->ignore() : event->accept(); m_contentChanged && !closeFile() ? event->ignore() : event->accept();
} }
void MainWindow::keyPressEvent(QKeyEvent *event)
{
if (event->modifiers() & Qt::ControlModifier)
{
if (event->key() == Qt::Key_M)
{
showMainToolbar();
return;
}
if (event->key() == Qt::Key_I)
{
showStatusIconToolbar();
return;
}
}
QMainWindow::keyPressEvent(event);
}
void MainWindow::setTitle(const QString &title) void MainWindow::setTitle(const QString &title)
{ {
if (title.isEmpty()) if (title.isEmpty())

@ -36,8 +36,26 @@ public slots:
void insertPicture(); void insertPicture();
void addNode();
void delNode();
void editNode();
void scaleUpNode();
void scaleDownNode();
void nodeColor();
void nodeTextColor();
void addEdge();
void delEdge();
void zoomIn();
void zoomOut();
void hintMode();
void showMainToolbar(const bool &show = true);
void showStatusIconToolbar(const bool &show = true);
protected: protected:
void closeEvent(QCloseEvent * event); void closeEvent(QCloseEvent * event);
void keyPressEvent(QKeyEvent *event);
private: private:
@ -48,6 +66,23 @@ private:
QString m_fileName; QString m_fileName;
bool m_contentChanged; bool m_contentChanged;
QAction *m_addNode;
QAction *m_delNode;
QAction *m_editNode;
QAction *m_scaleUpNode;
QAction *m_scaleDownNode;
QAction *m_nodeColor;
QAction *m_nodeTextColor;
QAction *m_addEdge;
QAction *m_delEdge;
QAction *m_zoomIn;
QAction *m_zoomOut;
QAction *m_hintMode;
QAction *m_moveNode;
QAction *m_subtree;
QAction *m_showMainToolbar;
QAction *m_showStatusIconToolbar;
QAction *m_doIt; QAction *m_doIt;
QAction *m_trash; QAction *m_trash;
QAction *m_info; QAction *m_info;

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>438</width> <width>600</width>
<height>349</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -23,7 +23,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>438</width> <width>600</width>
<height>21</height> <height>21</height>
</rect> </rect>
</property> </property>
@ -52,14 +52,31 @@
<addaction name="menuHelp"/> <addaction name="menuHelp"/>
</widget> </widget>
<widget class="QToolBar" name="mainToolBar"> <widget class="QToolBar" name="mainToolBar">
<property name="windowTitle">
<string>main toolbar</string>
</property>
<attribute name="toolBarArea"> <attribute name="toolBarArea">
<enum>TopToolBarArea</enum> <enum>LeftToolBarArea</enum>
</attribute> </attribute>
<attribute name="toolBarBreak"> <attribute name="toolBarBreak">
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
</widget> </widget>
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
<widget class="QToolBar" name="statusIcons_toolBar">
<property name="enabled">
<bool>true</bool>
</property>
<property name="windowTitle">
<string>status icons</string>
</property>
<attribute name="toolBarArea">
<enum>RightToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>true</bool>
</attribute>
</widget>
<action name="actionNew"> <action name="actionNew">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>

Loading…
Cancel
Save