]> Some of my projects - graph.git/commitdiff
Minor fixes with MinGW.
authorAPTX <redacted>
Tue, 20 Dec 2011 13:21:45 +0000 (14:21 +0100)
committerAPTX <redacted>
Tue, 20 Dec 2011 13:21:45 +0000 (14:21 +0100)
edge.cpp
edge.h
edgemodel.h
graph.h
main.cpp
mainwindow.cpp
node.h
nodemodel.h

index f8bdd21..4b3bc04 100644 (file)
--- a/edge.cpp
+++ b/edge.cpp
@@ -5,7 +5,7 @@
 #include <QGraphicsItem>
 #include "node.h"
 
-Edge::Edge(Node *startNode, Node *endNode) : m_startNode(startNode), m_endNode(endNode), m_weight(1)
+Edge::Edge(Node *startNode, Node *endNode, QGraphicsObject *parent) : QGraphicsObject(parent), m_startNode(startNode), m_endNode(endNode), m_weight(1)
 {
 
 }
@@ -37,7 +37,7 @@ void Edge::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWid
        QLineF line(sourcePoint, destPoint);
 
        // Draw the line itself
-       painter->setPen(QPen(m_color, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
+       painter->setPen(QPen(m_color, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
        painter->drawLine(line);
 
        // Draw the arrows
diff --git a/edge.h b/edge.h
index 64b94f8..844a162 100644 (file)
--- a/edge.h
+++ b/edge.h
@@ -16,7 +16,7 @@ class Edge : public QGraphicsObject
 public:
        enum { Type = UserType + 2};
 
-       Edge(Node *startNode, Node *endNode);
+       Edge(Node *startNode, Node *endNode, QGraphicsObject *parent = 0);
 
        int type() const
        {
@@ -65,6 +65,7 @@ private:
        Node *m_endNode;
 
        static const int arrowSize = 10;
+       static const int penWidth = 3;
 };
 
 QDataStream &operator<<(QDataStream &s, const Edge &edge);
index f49c89d..3e6e141 100644 (file)
@@ -7,7 +7,7 @@
 
 class EdgeModel : public QAbstractTableModel
 {
-       friend Graph;
+       friend class Graph;
        Q_OBJECT
 public:
        explicit EdgeModel(Graph *graph, QObject *parent = 0);
diff --git a/graph.h b/graph.h
index 9df696a..1e2c8f1 100644 (file)
--- a/graph.h
+++ b/graph.h
@@ -10,8 +10,8 @@
 
 class Graph : public QGraphicsScene
 {
-       friend NodeModel;
-       friend EdgeModel;
+       friend class NodeModel;
+       friend class EdgeModel;
     Q_OBJECT
        Q_PROPERTY(Mode mode READ mode WRITE setMode)
        Q_PROPERTY(bool addBothEdges READ addBothEdges WRITE setAddBothEdges)
index d951345..84d4b2b 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -5,7 +5,7 @@ int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
     MainWindow w;
-    w.show();
+       w.show();
     
     return a.exec();
 }
index e920570..005b46c 100644 (file)
@@ -32,6 +32,8 @@ MainWindow::MainWindow(QWidget *parent) :
 
        setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
 
+       ui->graphView->setRenderHint(QPainter::Antialiasing);
+
 //     QItemEditorCreatorBase *colorListCreator = new QStandardItemEditorCreator<ColorListEditor>();
 //     QItemEditorFactory::defaultFactory()->registerEditor(QVariant::Color, colorListCreator);
 
diff --git a/node.h b/node.h
index 7e8f3ab..a5b055a 100644 (file)
--- a/node.h
+++ b/node.h
@@ -9,7 +9,7 @@
 
 class Node : public QGraphicsObject
 {
-       friend Graph;
+       friend class Graph;
        Q_OBJECT
        Q_PROPERTY(QString label READ label WRITE setLabel)
        Q_PROPERTY(QColor color READ color WRITE setColor)
index 1c6f20d..0527b13 100644 (file)
@@ -7,7 +7,7 @@
 
 class NodeModel : public QAbstractTableModel
 {
-       friend Graph;
+       friend class Graph;
        Q_OBJECT
 public:
        explicit NodeModel(Graph *graph, QObject *parent = 0);