master
Denes Matetelki 14 years ago
parent 96b07fc1e5
commit 931b8f56e4

@ -10,7 +10,6 @@
#include "mainwindow.h" #include "mainwindow.h"
GraphWidget::GraphWidget(QWidget *parent) : GraphWidget::GraphWidget(QWidget *parent) :
QGraphicsView(parent), QGraphicsView(parent),
m_parent(parent), m_parent(parent),
@ -38,7 +37,7 @@ GraphWidget::GraphWidget(QWidget *parent) :
m_nodeList.append(node1); m_nodeList.append(node1);
Node *node2 = new Node(this); Node *node2 = new Node(this);
node2->setHtml(QString("work")); node2->setHtml(QString("work: <a href=www.hup.hu>hup.hu</a>"));
m_scene->addItem(node2); m_scene->addItem(node2);
node2->setPos(60, -10); node2->setPos(60, -10);
m_nodeList.append(node2); m_nodeList.append(node2);
@ -56,7 +55,7 @@ GraphWidget::GraphWidget(QWidget *parent) :
m_nodeList.append(node4); m_nodeList.append(node4);
Node *node5 = new Node(this); Node *node5 = new Node(this);
node5->setHtml(QString("joy")); node5->setHtml(QString("semmi kulonos"));
m_scene->addItem(node5); m_scene->addItem(node5);
node5->setPos(-10, 50); node5->setPos(-10, 50);
m_nodeList.append(node5); m_nodeList.append(node5);
@ -82,7 +81,7 @@ GraphWidget::GraphWidget(QWidget *parent) :
Node *node9 = new Node(this); Node *node9 = new Node(this);
node9->setHtml(QString("iam a <b>bald</b> and <i>italian</i> guy")); node9->setHtml(QString("iam a <b>bald</b> and <i>italian</i> guy"));
m_scene->addItem(node9); m_scene->addItem(node9);
node9->setPos(50, 40); node9->setPos(90, 90);
m_nodeList.append(node9); m_nodeList.append(node9);
Node *node10 = new Node(this); Node *node10 = new Node(this);
@ -100,7 +99,7 @@ GraphWidget::GraphWidget(QWidget *parent) :
Node *node12 = new Node(this); Node *node12 = new Node(this);
node12->setHtml(QString("lalalala")); node12->setHtml(QString("lalalala"));
m_scene->addItem(node12); m_scene->addItem(node12);
node12->setPos(130, -10); node12->setPos(170, -10);
m_nodeList.append(node12);; m_nodeList.append(node12);;
m_scene->addItem(new Edge(node1, node2)); m_scene->addItem(new Edge(node1, node2));

@ -4,6 +4,7 @@
#include <QGraphicsView> #include <QGraphicsView>
#include <QGraphicsScene> #include <QGraphicsScene>
#include <QKeyEvent> #include <QKeyEvent>
#include <QMovie>
#include "node.h" #include "node.h"
@ -41,7 +42,6 @@ private:
bool m_showingNodeNumbers; bool m_showingNodeNumbers;
QString m_followNumber; QString m_followNumber;
Node *m_followNode; Node *m_followNode;
}; };
#endif // GRAPHWIDGET_H #endif // GRAPHWIDGET_H

@ -11,13 +11,16 @@ Node::Node(GraphWidget *parent) :
m_graph(parent), m_graph(parent),
m_isActive(false), m_isActive(false),
m_number(-1), m_number(-1),
m_hasBorder(true) m_hasBorder(true),
m_numberIsSpecial(false) m_numberIsSpecial(false)
{ {
qDebug() << __PRETTY_FUNCTION__; qDebug() << __PRETTY_FUNCTION__;
setFlag(ItemIsMovable); setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges); setFlag(ItemSendsGeometryChanges);
setTextInteractionFlags(Qt::TextBrowserInteraction);
// setTextInteractionFlags(Qt::LinksAccessibleByMouse | Qt::LinksAccessibleByKeyboard);
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
// setZValue(1); // setZValue(1);
@ -231,3 +234,10 @@ double Node::calculateBiggestAngle()
return max_prev + max / 2 ; return max_prev + max / 2 ;
} }
void Node::linkActivated(const QString &link)
{
qDebug() << __PRETTY_FUNCTION__;
qDebug() << link;
}

@ -31,6 +31,7 @@ protected:
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
void mouseMoveEvent(QGraphicsSceneMouseEvent *event); void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
void linkActivated(const QString &link);
private: private:

@ -2,4 +2,4 @@
<qresource prefix="/"> <qresource prefix="/">
<file>heart.svg</file> <file>heart.svg</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save