From: APTX Date: Tue, 20 Dec 2011 13:21:45 +0000 (+0100) Subject: Minor fixes with MinGW. X-Git-Url: https://gitweb.aptx.org/?a=commitdiff_plain;h=6f71b76fc78a229bea169fee4e33cce66ad88bf1;p=graph.git Minor fixes with MinGW. --- diff --git a/edge.cpp b/edge.cpp index f8bdd21..4b3bc04 100644 --- a/edge.cpp +++ b/edge.cpp @@ -5,7 +5,7 @@ #include #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 --- 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); diff --git a/edgemodel.h b/edgemodel.h index f49c89d..3e6e141 100644 --- a/edgemodel.h +++ b/edgemodel.h @@ -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 --- 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) diff --git a/main.cpp b/main.cpp index d951345..84d4b2b 100644 --- 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(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index e920570..005b46c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -32,6 +32,8 @@ MainWindow::MainWindow(QWidget *parent) : setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); + ui->graphView->setRenderHint(QPainter::Antialiasing); + // QItemEditorCreatorBase *colorListCreator = new QStandardItemEditorCreator(); // QItemEditorFactory::defaultFactory()->registerEditor(QVariant::Color, colorListCreator); diff --git a/node.h b/node.h index 7e8f3ab..a5b055a 100644 --- 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) diff --git a/nodemodel.h b/nodemodel.h index 1c6f20d..0527b13 100644 --- a/nodemodel.h +++ b/nodemodel.h @@ -7,7 +7,7 @@ class NodeModel : public QAbstractTableModel { - friend Graph; + friend class Graph; Q_OBJECT public: explicit NodeModel(Graph *graph, QObject *parent = 0);