]> Some of my projects - graph.git/commitdiff
Minor fixes with MinGW.
authorAPTX <marek321@gmail.com>
Tue, 20 Dec 2011 13:21:45 +0000 (14:21 +0100)
committerAPTX <marek321@gmail.com>
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 f8bdd21ceb415adc8f1d4d306f57e65991a41da9..4b3bc04d93dacd0efefbdd5e1b8b16449a31c779 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 64b94f8d04584549a4154f52035f63dc4b83b6c9..844a1626070fdd5335fb7954184cf9b43d0e9cbf 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 f49c89d3d1c013c8d397747c761aae21d3d56ef2..3e6e141f132f694df427098dcd51d5000dee5636 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 9df696a6060ff441532c22bab555b6936ee1f51a..1e2c8f1762c110f8fddd8570c46c8099e05427cf 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 d951345f49a1773c5005dddee1ec9d5c9bb269dd..84d4b2bcceade8a4c3b2c1a6ab6b386f6fcc72a1 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 e920570b4f97207d353b04aa0a360c1c95cc17b0..005b46cf0352deeecf51504a37c02111d4333c8d 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 7e8f3ab3f8a3567caba9febb6521128d5bab86c3..a5b055aedadabfd874e5c522d4fc5fe44db1c42d 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 1c6f20dba962d8db45d8e1a8afb9c93f72d3ce29..0527b136bfc2869cf777c95c1f9b22011eda7070 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);