system tray, edge, node initial steps

master
Denes Matetelki 14 years ago
parent c679aa8814
commit d57ec2a21f

@ -0,0 +1,29 @@
{
<insert_a_suppression_name_here>
Memcheck:Cond
fun:_ZN20QSharedMemoryPrivate6detachEv
fun:_ZN13QSharedMemory6detachEv
fun:_ZN13QSharedMemory6setKeyERK7QString
fun:_ZN13QSharedMemoryD1Ev
fun:_ZN20QRasterWindowSurface5flushEP7QWidgetRK7QRegionRK6QPoint
fun:_Z8qt_flushP7QWidgetRK7QRegionP14QWindowSurfaceS0_RK6QPoint
fun:_ZN19QWidgetBackingStore5flushEP7QWidgetP14QWindowSurface
fun:_ZN19QWidgetBackingStore8endPaintERK7QRegionP14QWindowSurfaceP14BeginPaintInfo
fun:_ZN19QWidgetBackingStore4syncEv
fun:_ZN14QWidgetPrivate16syncBackingStoreEv
fun:_ZN7QWidget5eventEP6QEvent
fun:_ZN11QMainWindow5eventEP6QEvent
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
fun:_Znwm
fun:_ZN18QtSimulatorPrivate15connectToServerEv
fun:_ZN18QtSimulatorPrivate19SimulatorConnection18connectToSimulatorEv
fun:_ZN18QtSimulatorPrivate19SimulatorConnection8instanceEv
fun:_ZN9QColormap10initializeEv
fun:_Z7qt_initP19QApplicationPrivatei
fun:_ZN19QApplicationPrivate9constructEv
fun:_ZN12QApplicationC1ERiPPci
fun:main
}

@ -14,3 +14,5 @@ Let's do this project with Scrum.
- taskbar app - taskbar app
TODO:
- set about dialog's size fiexd

@ -0,0 +1,18 @@
#include "aboutdialog.h"
#include "ui_aboutdialog.h"
//#include <QLayout>
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::AboutDialog)
{
ui->setupUi(this);
connect(this, SIGNAL(finished(int)), parent,
SLOT(aboutDestroyed()));
}
AboutDialog::~AboutDialog()
{
delete ui;
}

@ -0,0 +1,22 @@
#ifndef ABOUTDIALOG_H
#define ABOUTDIALOG_H
#include <QDialog>
namespace Ui {
class AboutDialog;
}
class AboutDialog : public QDialog
{
Q_OBJECT
public:
explicit AboutDialog(QWidget *parent = 0);
~AboutDialog();
private:
Ui::AboutDialog *ui;
};
#endif // ABOUTDIALOG_H

@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AboutDialog</class>
<widget class="QDialog" name="AboutDialog">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>329</width>
<height>142</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>About QtMindMap</string>
</property>
<property name="sizeGripEnabled">
<bool>false</bool>
</property>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="geometry">
<rect>
<x>100</x>
<y>100</y>
<width>211</width>
<height>31</height>
</rect>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close</set>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>0</y>
<width>101</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>QtMindMap 0.1</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>30</x>
<y>40</y>
<width>181</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Mindmap software in QT</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>30</x>
<y>70</y>
<width>291</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Denes Matetelki &lt;a href=&quot;mailto:denes.matetelki@gmail.com&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#508ed8;&quot;&gt;denes.matetelki@gmail.com&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AboutDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AboutDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

@ -0,0 +1,104 @@
#include <QPainter>
#include "edge.h"
#include "node.h"
#include <math.h>
static const double Pi = 3.14159265358979323846264338327950288419717;
static double TwoPi = 2.0 * Pi;
Edge::Edge(Node *sourceNode, Node *destNode)
: arrowSize(10)
{
setAcceptedMouseButtons(0);
source = sourceNode;
dest = destNode;
source->addEdge(this);
dest->addEdge(this);
adjust();
setZValue(1);
}
Node *Edge::sourceNode() const
{
return source;
}
Node *Edge::destNode() const
{
return dest;
}
void Edge::adjust()
{
if (!source || !dest)
return;
QLineF line(mapFromItem(source, 0, 0) + source->boundingRect().center(),
mapFromItem(dest, 0, 0) + dest->boundingRect().center());
qreal length = line.length();
prepareGeometryChange();
if (length > qreal(20.)) {
// QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length);
// QPointF sourceOffset( );
// if ( source->contains( source->boundingRect().center() + source->boundingRect().height() / 2 / tan(line.angle())),
// source->boundingRect().width() / 2 )
// {
// sourcePoint = line.p1() + QPointF( , tan( line.angle() ) * source->boundingRect().height() / 2 );
// }
sourcePoint = line.p1();
destPoint = line.p2();
} else {
sourcePoint = destPoint = line.p1();
}
}
QRectF Edge::boundingRect() const
{
if (!source || !dest)
return QRectF();
qreal penWidth = 1;
qreal extra = (penWidth + arrowSize) / 2.0;
return QRectF(sourcePoint, QSizeF(destPoint.x() - sourcePoint.x(),
destPoint.y() - sourcePoint.y()))
.normalized()
.adjusted(-extra, -extra, extra, extra);
}
void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
if (!source || !dest)
return;
QLineF line(sourcePoint, destPoint);
if (qFuzzyCompare(line.length(), qreal(0.)))
return;
// Draw the line itself
painter->setPen(QPen(Qt::black, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
painter->drawLine(line);
// Draw the arrows
double angle = ::acos(line.dx() / line.length());
if (line.dy() >= 0)
angle = TwoPi - angle;
// QPointF sourceArrowP1 = sourcePoint + QPointF(sin(angle + Pi / 3) * arrowSize,
// cos(angle + Pi / 3) * arrowSize);
// QPointF sourceArrowP2 = sourcePoint + QPointF(sin(angle + Pi - Pi / 3) * arrowSize,
// cos(angle + Pi - Pi / 3) * arrowSize);
QPointF destArrowP1 = destPoint + QPointF(sin(angle - Pi / 3) * arrowSize,
cos(angle - Pi / 3) * arrowSize);
QPointF destArrowP2 = destPoint + QPointF(sin(angle - Pi + Pi / 3) * arrowSize,
cos(angle - Pi + Pi / 3) * arrowSize);
painter->setBrush(Qt::black);
// painter->drawPolygon(QPolygonF() << line.p1() << sourceArrowP1 << sourceArrowP2);
painter->drawPolygon(QPolygonF() << line.p2() << destArrowP1 << destArrowP2);
}

@ -0,0 +1,35 @@
#ifndef EDGE_H
#define EDGE_H
#include <QGraphicsItem>
class Node;
class Edge : public QGraphicsItem
{
// Q_OBJECT
public:
Edge(Node *sourceNode, Node *destNode);
Node *sourceNode() const;
Node *destNode() const;
void adjust();
enum { Type = UserType + 2 };
int type() const { return Type; }
protected:
QRectF boundingRect() const;
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
Node *source, *dest;
QPointF sourcePoint;
QPointF destPoint;
qreal arrowSize;
};
#endif

@ -0,0 +1,107 @@
#include "graphwidget.h"
#include <QDebug>
#include "node.h"
//#include <QGraphicsTextItem>
#include "edge.h"
#include "math.h"
GraphWidget::GraphWidget(QWidget *parent)
{
qDebug() << __PRETTY_FUNCTION__;
scene = new QGraphicsScene(this);
scene->setItemIndexMethod(QGraphicsScene::NoIndex);
scene->setSceneRect(-200, -200, 400, 400);
setScene(scene);
setCacheMode(CacheBackground);
setViewportUpdateMode(BoundingRectViewportUpdate);
setRenderHint(QPainter::Antialiasing);
setTransformationAnchor(AnchorUnderMouse);
scale(qreal(0.8), qreal(0.8));
setMinimumSize(400, 400);
// node1 = new Node(this);
// scene->addItem(node1);
// node1->setPos(0, 0);
Node *node1 = new Node();
node1->setHtml(QString("salalal"));
scene->addItem(node1);
node1->setPos(-100, -100);
Node *node2 = new Node();
node2->setHtml(QString("<b>denes</b> is\na really nice person"));
scene->addItem(node2);
node2->setPos(100, 100);
// QGraphicsTextItem *item = new QGraphicsTextItem();
// item->setPlainText(QString("salalal"));
// scene->addItem(item);
// item->setPos(20, 20);
// item->setFlag(QGraphicsItem::ItemIsMovable);
// item->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
// item->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
// item->setZValue(-1);
// QGraphicsTextItem *item2 = new QGraphicsTextItem();
// item2->setHtml(QString("<b>denes</b> is\na really nice person"));
// scene->addItem(item2);
// item2->setPos(10, 10);
// item2->setFlag(QGraphicsItem::ItemIsMovable);
// item2->setFlag(QGraphicsItem::ItemSendsGeometryChanges);
// item2->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
// item2->setZValue(-1);
scene->addItem(new Edge(node1, node2));
activeNode = node1;
activeNode->setFocus();
}
void GraphWidget::keyPressEvent(QKeyEvent *event)
{
switch (event->key()) {
// case Qt::Key_Up:
// centerNode->moveBy(0, -20);
// break;
// case Qt::Key_Down:
// centerNode->moveBy(0, 20);
// break;
// case Qt::Key_Left:
// centerNode->moveBy(-20, 0);
// break;
// case Qt::Key_Right:
// centerNode->moveBy(20, 0);
// break;
case Qt::Key_Plus:
scaleView(qreal(1.2));
break;
case Qt::Key_Minus:
scaleView(1 / qreal(1.2));
break;
// case Qt::Key_Space:
// case Qt::Key_Enter:
// foreach (QGraphicsItem *item, scene()->items()) {
// if (qgraphicsitem_cast<Node *>(item))
// item->setPos(-150 + qrand() % 300, -150 + qrand() % 300);
// }
// break;
default:
QGraphicsView::keyPressEvent(event);
}
}
void GraphWidget::wheelEvent(QWheelEvent *event)
{
scaleView(pow((double)2, -event->delta() / 240.0));
}
void GraphWidget::scaleView(qreal scaleFactor)
{
qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
if (factor < 0.2 || factor > 10) return;
scale(scaleFactor, scaleFactor);
}

@ -0,0 +1,32 @@
#ifndef GRAPHWIDGET_H
#define GRAPHWIDGET_H
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QKeyEvent>
#include "node.h"
//class Node;
class GraphWidget : public QGraphicsView
{
Q_OBJECT
public:
GraphWidget(QWidget *parent = 0);
protected:
// void drawBackground(QPainter *painter, const QRectF &rect);
void keyPressEvent(QKeyEvent *event);
void wheelEvent(QWheelEvent *event);
void scaleView(qreal scaleFactor);
private:
Node *activeNode;
QGraphicsScene *scene;
};
#endif // GRAPHWIDGET_H

@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) --><svg viewBox="100 200 550 500" height="595.27559pt" id="svg1" inkscape:version="0.40+cvs" sodipodi:docbase="C:\Documents and Settings\Jon Phillips\My Documents\projects\clipart-project\submissions" sodipodi:docname="heart-left-highlight.svg" sodipodi:version="0.32" width="595.27559pt" xmlns="http://www.w3.org/2000/svg" xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:sodipodi="http://inkscape.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:svg="http://www.w3.org/2000/svg">
<metadata>
<rdf:RDF xmlns:cc="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<cc:Work rdf:about="">
<dc:title>Heart Left-Highlight</dc:title>
<dc:description>This is a normal valentines day heart.</dc:description>
<dc:subject>
<rdf:Bag>
<rdf:li>holiday</rdf:li>
<rdf:li>valentines</rdf:li>
<rdf:li></rdf:li>
<rdf:li>valentine</rdf:li>
<rdf:li>hash(0x8a091c0)</rdf:li>
<rdf:li>hash(0x8a0916c)</rdf:li>
<rdf:li>signs_and_symbols</rdf:li>
<rdf:li>hash(0x8a091f0)</rdf:li>
<rdf:li>day</rdf:li>
</rdf:Bag>
</dc:subject>
<dc:publisher>
<cc:Agent rdf:about="http://www.openclipart.org">
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:publisher>
<dc:creator>
<cc:Agent>
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:creator>
<dc:rights>
<cc:Agent>
<dc:title>Jon Phillips</dc:title>
</cc:Agent>
</dc:rights>
<dc:date></dc:date>
<dc:format>image/svg+xml</dc:format>
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
<cc:license rdf:resource="http://web.resource.org/cc/PublicDomain"/>
<dc:language>en</dc:language>
</cc:Work>
<cc:License rdf:about="http://web.resource.org/cc/PublicDomain">
<cc:permits rdf:resource="http://web.resource.org/cc/Reproduction"/>
<cc:permits rdf:resource="http://web.resource.org/cc/Distribution"/>
<cc:permits rdf:resource="http://web.resource.org/cc/DerivativeWorks"/>
</cc:License>
</rdf:RDF>
</metadata>
<defs id="defs3"/>
<sodipodi:namedview bordercolor="#666666" borderopacity="1.0" id="base" inkscape:current-layer="layer1" inkscape:cx="549.40674" inkscape:cy="596.00159" inkscape:document-units="px" inkscape:guide-bbox="true" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:window-height="615" inkscape:window-width="866" inkscape:window-x="88" inkscape:window-y="116" inkscape:zoom="0.35000000" pagecolor="#ffffff" showguides="true"/>
<g id="layer1" inkscape:groupmode="layer" inkscape:label="Layer 1">
<path d="M 263.41570,235.14588 C 197.17570,235.14588 143.41575,288.90587 143.41575,355.14588 C 143.41575,489.90139 279.34890,525.23318 371.97820,658.45392 C 459.55244,526.05056 600.54070,485.59932 600.54070,355.14588 C 600.54070,288.90588 546.78080,235.14587 480.54070,235.14588 C 432.49280,235.14588 391.13910,263.51631 371.97820,304.33338 C 352.81740,263.51630 311.46370,235.14587 263.41570,235.14588 z " id="path7" sodipodi:nodetypes="ccccccc" style="fill:#e60000;fill-opacity:1.0000000;stroke:#000000;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
<path d="M 265.00000,253.59375 C 207.04033,253.59375 160.00000,300.63407 160.00000,358.59375 C 160.00000,476.50415 278.91857,507.43251 359.96875,624.00000 C 366.52868,614.08205 220.00000,478.47309 220.00000,378.59375 C 220.00000,320.63407 267.04033,273.59375 325.00000,273.59375 C 325.50453,273.59375 325.99718,273.64912 326.50000,273.65625 C 309.22436,261.07286 288.00557,253.59374 265.00000,253.59375 z " id="path220" sodipodi:nodetypes="ccccccc" style="fill:#e6e6e6;fill-opacity:0.64556962;stroke:none;stroke-width:18.700001;stroke-miterlimit:4.0000000;stroke-opacity:1.0000000"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

@ -1,11 +1,82 @@
#include <QtGui/QApplication> #include <stdlib.h> // EXIT_SUCCESS
#include <iostream> // cout
#include <QtGui>
//#include <QtGui/QApplication>
#include <QDebug>
#include <QRegExp>
#include "mainwindow.h" #include "mainwindow.h"
#include "systemtray.h"
void printUsage()
{
std::cout << "Usage: qtmindmap [OPTION][FILE]" << std::endl
<< "Mindmap program in QT" << std::endl
<< std::endl
<< "Options:" << std::endl
<< "-h, --help\tPrints this help." << std::endl
<< "-t, --tray\tStarts application in system tray." << std::endl
<< std::endl
<< "Report bugs to: denes.matetelki@gmail.com" << std::endl;
}
bool parseCmdLineArgs(bool &isSystemTray, QString &filePath)
{
QStringList cmdlineArgs = QCoreApplication::arguments();
cmdlineArgs.removeFirst();
QRegExp help("^-(h|-help)$");
if (!cmdlineArgs.filter(help).isEmpty()) return false;
QRegExp tray("^-(t|-tray)$");
if (!cmdlineArgs.filter(tray).isEmpty()) isSystemTray = true;
QRegExp all("^-(t|-tray|h|-help)$");
QStringList others;
foreach (QString arg, cmdlineArgs) if (all.indexIn(arg)==-1) others.append(arg);
if (others.size() > 1) return false;
if (others.size()==1) filePath = others.first();
return true;
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
Q_INIT_RESOURCE(qtmindmap);
QApplication a(argc, argv); QApplication a(argc, argv);
bool isSystemTray(false);
QString filePath;
if (!parseCmdLineArgs(isSystemTray,filePath))
{
printUsage();
return EXIT_FAILURE;
}
MainWindow w; MainWindow w;
w.show(); SystemTray *systemTray;
isSystemTray = true;
if (isSystemTray)
{
if (!QSystemTrayIcon::isSystemTrayAvailable())
{
QMessageBox::critical(0,
QObject::tr("Systray"),
QObject::tr("I couldn't detect any system tray on this system."));
return EXIT_FAILURE;
}
QApplication::setQuitOnLastWindowClosed(false);
systemTray = new SystemTray(&w);
systemTray->show();
}
w.show();
return a.exec(); return a.exec();
} }

@ -1,14 +1,60 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "ui_mainwindow.h" #include "ui_mainwindow.h"
#include "aboutdialog.h"
#include <QDebug>
//#include <QLayout>
MainWindow::MainWindow(QWidget *parent) : MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent), QMainWindow(parent),
ui(new Ui::MainWindow) ui(new Ui::MainWindow),
aboutDialog(0)
{ {
qDebug() << __PRETTY_FUNCTION__;
ui->setupUi(this); ui->setupUi(this);
connect(ui->actionNew, SIGNAL(activated()), this, SLOT(klakk()));
connect(ui->actionOpen, SIGNAL(activated()), this, SLOT(klakk()));
connect(ui->actionSave, SIGNAL(activated()), this, SLOT(klakk()));
connect(ui->actionClose, SIGNAL(activated()), this, SLOT(klakk()));
connect(ui->actionQuit, SIGNAL(activated()), QApplication::instance(),
SLOT(closeAllWindows()));
connect(ui->actionAbout_QtMindMap, SIGNAL(activated()), this,
SLOT(about()));
graphicsView = new GraphWidget(ui->centralWidget);
setCentralWidget(graphicsView);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
{ {
qDebug() << __PRETTY_FUNCTION__;
delete ui; delete ui;
if (aboutDialog) delete aboutDialog;
}
void MainWindow::klakk()
{
qDebug() << __PRETTY_FUNCTION__;
}
void MainWindow::about()
{
qDebug() << __PRETTY_FUNCTION__;
setDisabled(true);
if (aboutDialog == 0) aboutDialog = new AboutDialog(this);
aboutDialog->setEnabled(true); // children inherits enabled status
aboutDialog->show();
// aboutDialog->layout()->setSizeConstraint( QLayout::SetFixedSize );
}
void MainWindow::aboutDestroyed()
{
qDebug() << __PRETTY_FUNCTION__;
qDebug() << aboutDialog;
setEnabled(true);
} }

@ -2,6 +2,10 @@
#define MAINWINDOW_H #define MAINWINDOW_H
#include <QMainWindow> #include <QMainWindow>
//#include <QPointer>
#include "aboutdialog.h"
#include "graphwidget.h"
namespace Ui { namespace Ui {
class MainWindow; class MainWindow;
@ -15,8 +19,16 @@ public:
explicit MainWindow(QWidget *parent = 0); explicit MainWindow(QWidget *parent = 0);
~MainWindow(); ~MainWindow();
public slots:
void klakk(void);
void about();
void aboutDestroyed();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
AboutDialog* aboutDialog;
// QPointer<AboutDialog> aboutDialog;
GraphWidget *graphicsView;
}; };
#endif // MAINWINDOW_H #endif // MAINWINDOW_H

@ -6,12 +6,12 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>438</width>
<height>300</height> <height>349</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>MainWindow</string> <string>QtMindMap</string>
</property> </property>
<widget class="QWidget" name="centralWidget"/> <widget class="QWidget" name="centralWidget"/>
<widget class="QMenuBar" name="menuBar"> <widget class="QMenuBar" name="menuBar">
@ -19,13 +19,13 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>438</width>
<height>23</height> <height>23</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">
<property name="title"> <property name="title">
<string>File</string> <string>&amp;File</string>
</property> </property>
<addaction name="actionNew"/> <addaction name="actionNew"/>
<addaction name="actionOpen"/> <addaction name="actionOpen"/>
@ -36,7 +36,7 @@
</widget> </widget>
<widget class="QMenu" name="menuHelp"> <widget class="QMenu" name="menuHelp">
<property name="title"> <property name="title">
<string>Help</string> <string>&amp;Help</string>
</property> </property>
<addaction name="actionAbout_QtMindMap"/> <addaction name="actionAbout_QtMindMap"/>
</widget> </widget>
@ -54,7 +54,7 @@
<widget class="QStatusBar" name="statusBar"/> <widget class="QStatusBar" name="statusBar"/>
<action name="actionNew"> <action name="actionNew">
<property name="text"> <property name="text">
<string>New</string> <string>&amp;New</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+N</string> <string>Ctrl+N</string>
@ -62,7 +62,7 @@
</action> </action>
<action name="actionOpen"> <action name="actionOpen">
<property name="text"> <property name="text">
<string>Open</string> <string>&amp;Open</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+O</string> <string>Ctrl+O</string>
@ -70,7 +70,7 @@
</action> </action>
<action name="actionSave"> <action name="actionSave">
<property name="text"> <property name="text">
<string>Save</string> <string>&amp;Save</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+S</string> <string>Ctrl+S</string>
@ -78,7 +78,7 @@
</action> </action>
<action name="actionQuit"> <action name="actionQuit">
<property name="text"> <property name="text">
<string>Quit</string> <string>&amp;Quit</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+Q</string> <string>Ctrl+Q</string>
@ -86,12 +86,12 @@
</action> </action>
<action name="actionAbout_QtMindMap"> <action name="actionAbout_QtMindMap">
<property name="text"> <property name="text">
<string>About QtMindMap</string> <string>&amp;About QtMindMap</string>
</property> </property>
</action> </action>
<action name="actionClose"> <action name="actionClose">
<property name="text"> <property name="text">
<string>Close</string> <string>&amp;Close</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+W</string> <string>Ctrl+W</string>
@ -101,4 +101,8 @@
<layoutdefault spacing="6" margin="11"/> <layoutdefault spacing="6" margin="11"/>
<resources/> <resources/>
<connections/> <connections/>
<slots>
<signal>cica()</signal>
<signal>rdfgdfg()</signal>
</slots>
</ui> </ui>

@ -0,0 +1,73 @@
#include "node.h"
#include <QPainter>
#include <QStyleOption>
#include <QDebug>
Node::Node(GraphWidget *parent) : graph(parent), active(false)
{
qDebug() << __PRETTY_FUNCTION__;
setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges);
setCacheMode(DeviceCoordinateCache);
setZValue(2);
// shall I set it after some spec key?
setTextInteractionFlags(Qt::TextEditorInteraction);
}
void Node::addEdge(Edge *edge)
{
qDebug() << __PRETTY_FUNCTION__;
edgeList << edge;
edge->adjust();
}
QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
{
qDebug() << __PRETTY_FUNCTION__;
switch (change) {
case ItemPositionHasChanged:
foreach (Edge *edge, edgeList) edge->adjust();
// graph->itemMoved();
break;
default:
break;
};
return QGraphicsItem::itemChange(change, value);
}
void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;
// active = true;
// setScale(1.2);
update();
QGraphicsTextItem::mousePressEvent(event);
}
void Node::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;
// active = false;
// setScale(1.0);
update();
QGraphicsTextItem::mouseReleaseEvent(event);
}
//void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
//{
// qDebug() << __PRETTY_FUNCTION__;
// QGraphicsTextItem::paint(painter, option, widget);
// qDebug() << "I " << (hasFocus() ? "have " : "don't have ") << "focus.";
// setScale(hasFocus() ? 1.2 : 1.0);
//// setScale(active ? 1.2 : 1.0);
//}

@ -0,0 +1,34 @@
#ifndef NODE_H
#define NODE_H
#include <QGraphicsTextItem>
#include "edge.h"
#include "graphwidget.h"
class GraphWidget;
class Node : public QGraphicsTextItem
{
// Q_OBJECT
public:
Node(GraphWidget *graphWidget = 0);
void addEdge(Edge *edge);
QList<Edge *> edges() const;
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
// void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
private:
QList<Edge *> edgeList;
GraphWidget *graph;
bool active;
};
#endif // NODE_H

@ -4,15 +4,28 @@
# #
#------------------------------------------------- #-------------------------------------------------
QT += core gui QT += core gui svg
TARGET = qtmindmap TARGET = qtmindmap
TEMPLATE = app TEMPLATE = app
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp mainwindow.cpp \
aboutdialog.cpp \
graphwidget.cpp \
node.cpp \
edge.cpp \
systemtray.cpp
HEADERS += mainwindow.h HEADERS += mainwindow.h \
aboutdialog.h \
graphwidget.h \
node.h \
edge.h \
systemtray.h
FORMS += mainwindow.ui FORMS += mainwindow.ui \
aboutdialog.ui
RESOURCES = qtmindmap.qrc

@ -0,0 +1,244 @@
<!DOCTYPE QtCreatorProject>
<qtcreator>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value key="EditorConfiguration.AutoIndent" type="bool">true</value>
<value key="EditorConfiguration.AutoSpacesForTabs" type="bool">false</value>
<value key="EditorConfiguration.Codec" type="QByteArray">System</value>
<value key="EditorConfiguration.DoubleIndentBlocks" type="bool">false</value>
<value key="EditorConfiguration.IndentBraces" type="bool">false</value>
<value key="EditorConfiguration.IndentSize" type="int">4</value>
<value key="EditorConfiguration.MouseNavigation" type="bool">true</value>
<value key="EditorConfiguration.PaddingMode" type="int">1</value>
<value key="EditorConfiguration.ScrollWheelZooming" type="bool">true</value>
<value key="EditorConfiguration.SmartBackspace" type="bool">false</value>
<value key="EditorConfiguration.SpacesForTabs" type="bool">true</value>
<value key="EditorConfiguration.TabKeyBehavior" type="int">0</value>
<value key="EditorConfiguration.TabSize" type="int">8</value>
<value key="EditorConfiguration.UseGlobal" type="bool">true</value>
<value key="EditorConfiguration.Utf8BomBehavior" type="int">1</value>
<value key="EditorConfiguration.addFinalNewLine" type="bool">true</value>
<value key="EditorConfiguration.cleanIndentation" type="bool">true</value>
<value key="EditorConfiguration.cleanWhitespace" type="bool">true</value>
<value key="EditorConfiguration.inEntireDocument" type="bool">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
<value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">1</value>
<value key="ProjectExplorer.Target.ActiveDeployConfiguration" type="int">0</value>
<value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Qt in PATH Release</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/home/cs0rbagomba/projects/qtmindmap-build-desktop</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
<value key="ProjectExplorer.BuildCOnfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qmake</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
<value key="QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary" type="bool">false</value>
<value key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QString"></value>
<value key="QtProjectManager.QMakeBuildStep.QMakeForced" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildStepList.Step.1" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString"></value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">2</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Build</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Build</value>
</valuemap>
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.1" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildStepList.Step.0" type="QVariantMap">
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Make</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
<value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
<value key="Qt4ProjectManager.MakeStep.MakeArguments" type="QString">clean</value>
<value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
</valuemap>
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Clean</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Clean</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">2</value>
<value key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment" type="bool">false</value>
<valuelist key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Qt in PATH Debug</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString"></value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="QString">ProjectExplorer.ToolChain.Gcc:/usr/bin/g++.x86-linux-generic-elf-64bit.</value>
<value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
</valuemap>
<value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
<valuemap key="ProjectExplorer.Target.DeployConfiguration.0" type="QVariantMap">
<valuemap key="ProjectExplorer.BuildConfiguration.BuildStepList.0" type="QVariantMap">
<value key="ProjectExplorer.BuildStepList.StepsCount" type="int">0</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Deploy</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value key="ProjectExplorer.BuildConfiguration.BuildStepListCount" type="int">1</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">No deployment</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value key="ProjectExplorer.Target.DeployConfigurationCount" type="int">1</value>
<valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
<valuelist key="Analyzer.Valgrind.AddedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.FilterExternalIssues" type="bool">true</value>
<value key="Analyzer.Valgrind.NumCallers" type="int">25</value>
<valuelist key="Analyzer.Valgrind.RemovedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.TrackOrigins" type="bool">true</value>
<value key="Analyzer.Valgrind.ValgrindExecutable" type="QString">valgrind</value>
<valuelist key="Analyzer.Valgrind.VisibleErrorKinds" type="QVariantList">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">qtmindmap</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QString"></value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">qtmindmap.pro</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
<value key="RunConfiguration.QmlDebugServerPort" type="uint">3768</value>
<value key="RunConfiguration.UseCppDebugger" type="bool">true</value>
<value key="RunConfiguration.UseQmlDebugger" type="bool">false</value>
</valuemap>
<valuemap key="ProjectExplorer.Target.RunConfiguration.1" type="QVariantMap">
<valuelist key="Analyzer.Valgrind.AddedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.FilterExternalIssues" type="bool">true</value>
<value key="Analyzer.Valgrind.NumCallers" type="int">25</value>
<valuelist key="Analyzer.Valgrind.RemovedSupressionFiles" type="QVariantList"/>
<value key="Analyzer.Valgrind.TrackOrigins" type="bool">true</value>
<value key="Analyzer.Valgrind.ValgrindExecutable" type="QString">valgrind</value>
<valuelist key="Analyzer.Valgrind.VisibleErrorKinds" type="QVariantList">
<value type="int">0</value>
<value type="int">1</value>
<value type="int">2</value>
<value type="int">3</value>
<value type="int">4</value>
<value type="int">5</value>
<value type="int">6</value>
<value type="int">7</value>
<value type="int">8</value>
<value type="int">9</value>
<value type="int">10</value>
<value type="int">11</value>
<value type="int">12</value>
<value type="int">13</value>
<value type="int">14</value>
</valuelist>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments" type="QString">-q --tool=memcheck --leak-check=full --leak-resolution=low --suppressions=../qtmindmap/Qt47supp.txt ./qtmindmap</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.BaseEnvironmentBase" type="int">2</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.Executable" type="QString">valgrind</value>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.UseTerminal" type="bool">false</value>
<valuelist key="ProjectExplorer.CustomExecutableRunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
<value key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory" type="QString">/home/cs0rbagomba/projects/qtmindmap-build-desktop</value>
<value key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName" type="QString">Run valgrind</value>
<value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
<value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">ProjectExplorer.CustomExecutableRunConfiguration</value>
<value key="RunConfiguration.QmlDebugServerPort" type="uint">3768</value>
<value key="RunConfiguration.UseCppDebugger" type="bool">true</value>
<value key="RunConfiguration.UseQmlDebugger" type="bool">false</value>
</valuemap>
<value key="ProjectExplorer.Target.RunConfigurationCount" type="int">2</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
<value type="QString">{75e4e232-a182-46a5-bb12-10bf44c99a73}</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">9</value>
</data>
</qtcreator>

@ -0,0 +1,5 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/">
<file>heart.svg</file>
</qresource>
</RCC>

@ -0,0 +1,21 @@
<?xml version="1.0"?>
<ui version="4.0">
<class>ScrollArea</class>
<widget class="QScrollArea" name="ScrollArea">
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>ScrollArea</string>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents"/>
</widget>
</ui>

@ -0,0 +1,41 @@
#include "systemtray.h"
#include <QtGui>
//#include <QAction>
//#include <QMenu>
SystemTray::SystemTray(MainWindow* parent)
: QSystemTrayIcon(parent),
mainWindow(parent)
{
// QSystemTrayIcon *trayIcon;
minimizeAction = new QAction(tr("Mi&nimize"), this);
connect(minimizeAction, SIGNAL(triggered()), parent, SLOT(hide()));
maximizeAction = new QAction(tr("Ma&ximize"), this);
connect(maximizeAction, SIGNAL(triggered()), parent, SLOT(showMaximized()));
restoreAction = new QAction(tr("&Restore"), this);
connect(restoreAction, SIGNAL(triggered()), parent, SLOT(showNormal()));
quitAction = new QAction(tr("&Quit"), this);
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
/// @BUG shall pass this as parent
trayIconMenu = new QMenu(0);
trayIconMenu->addAction(minimizeAction);
trayIconMenu->addAction(maximizeAction);
trayIconMenu->addAction(restoreAction);
trayIconMenu->addSeparator();
trayIconMenu->addAction(quitAction);
// trayIcon = new QSystemTrayIcon(this);
// trayIcon->setContextMenu(trayIconMenu);
setContextMenu(trayIconMenu);
icon = new QIcon(":/heart.svg");
setIcon(QIcon(":/heart.svg"));
}

@ -0,0 +1,24 @@
#ifndef SYSTEMTRAY_H
#define SYSTEMTRAY_H
#include <QSystemTrayIcon>
#include "mainwindow.h"
class SystemTray : public QSystemTrayIcon
{
// Q_OBJECT
public:
SystemTray(MainWindow *parent = 0);
private:
MainWindow *mainWindow;
QMenu *trayIconMenu;
QAction *minimizeAction;
QAction *maximizeAction;
QAction *restoreAction;
QAction *quitAction;
QIcon *icon;
};
#endif // SYSTEMTRAY_H

@ -0,0 +1,21 @@
<ui version="4.0">
<author/>
<comment/>
<exportmacro/>
<class>SystemTray</class>
<widget class="QWidget" name="SystemTray">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
</widget>
<pixmapfunction/>
<connections/>
</ui>
Loading…
Cancel
Save