changeset 373:1f189d0ceab4

merge
author Max Samukha <maxter@spambox.com>
date Thu, 08 Jul 2010 17:20:02 +0300
parents a032df77b6ab (current diff) 12f60887ed15 (diff)
children 681af90e1d53
files cpp/qt_qtd/qtd_core.cpp d2/qt/core/QPoint.d generator/typesystem_gui.xml
diffstat 9 files changed, 694 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cpp/qt_qtd/qtd_core.cpp	Thu Jul 08 17:19:05 2010 +0300
+++ b/cpp/qt_qtd/qtd_core.cpp	Thu Jul 08 17:20:02 2010 +0300
@@ -67,6 +67,16 @@
     return qUnregisterResourceData(version, tree, name, data);
 }
 
+QTD_EXTERN QTD_DLL_PUBLIC int qtd_qrand()
+{
+    return qrand();
+}
+
+QTD_EXTERN QTD_DLL_PUBLIC void qtd_qsrand(uint seed)
+{
+    qsrand(seed);
+}
+
 //
 // QObjectLink implementation
 //
--- a/d2/qt/QGlobal.d	Thu Jul 08 17:19:05 2010 +0300
+++ b/d2/qt/QGlobal.d	Thu Jul 08 17:20:02 2010 +0300
@@ -450,9 +450,18 @@
 /*
   Reentrant versions of basic rand() functions for random number generation
 */
-void qsrand(uint seed);
-int qrand();
+private extern(C) int qtd_qrand();
+private extern(C) void qtd_qsrand(uint);
 
+void qsrand(uint seed)
+{
+    qtd_qsrand(seed);
+}
+
+int qrand()
+{
+    return qtd_qrand();
+}
 
 /*
    This gives us the possibility to check which modules the user can
@@ -549,4 +558,4 @@
 }
 +/
 
-alias void DArray;
\ No newline at end of file
+alias void DArray;
--- a/d2/qt/core/QPoint.d	Thu Jul 08 17:19:05 2010 +0300
+++ b/d2/qt/core/QPoint.d	Thu Jul 08 17:20:02 2010 +0300
@@ -139,17 +139,17 @@
         yp = p.y();
     }
 
-    bool isNull() //const
+    bool isNull() const
     {
         return qIsNull(xp) && qIsNull(yp);
     }
 
-    qreal x() //const
+    qreal x() const
     {
         return xp;
     }
 
-    qreal y() //const
+    qreal y() const
     {
         return yp;
     }
@@ -164,12 +164,12 @@
         yp = ypos;
     }
 /*
-inline qreal &QPointF::rx()
+ref qreal rx()
 {
         return xp;
 }
 
-inline qreal &QPointF::ry()
+ref qreal ry()
 {
     return yp;
 }
@@ -208,7 +208,7 @@
         return QPointF(xp/c, yp/c);
     }
 
-    QPoint toPoint() //const
+    QPoint toPoint() const
     {
         return QPoint(qRound(xp), qRound(yp));
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/graphicsview/elasticnodes/build.sh	Thu Jul 08 17:20:02 2010 +0300
@@ -0,0 +1,4 @@
+#! /bin/bash
+
+dmd main.d graphwidget.d node.d edge.d -L-lqtdgui -L-lqtdcore -L-lcpp_core -L-lcpp_gui -L-lQtGui -L-lQtCore -ofelasticnodes
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/graphicsview/elasticnodes/edge.d	Thu Jul 08 17:20:02 2010 +0300
@@ -0,0 +1,171 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+module edge;
+
+import std.math;
+import qt.gui.QGraphicsItem;
+
+import node;
+
+static const double Pi = 3.14159265358979323846264338327950288419717;
+static double TwoPi = 2.0 * Pi;
+
+class Edge : QGraphicsItem
+{
+public:
+    this(Node sourceNode, Node destNode)
+    {
+        arrowSize = 10;
+        setAcceptedMouseButtons(0);
+        source = sourceNode;
+        dest = destNode;
+        source.addEdge(this);
+        dest.addEdge(this);
+        adjust();
+    }
+
+    Node sourceNode() const
+    {
+        return cast(Node)source;
+    }
+    
+    void setSourceNode(Node node)
+    {
+        source = node;
+        adjust();
+    }
+
+    Node destNode() const
+    {
+        return cast(Node)dest;
+    }
+    
+    void setDestNode(Node node)
+    {
+        dest = node;
+        adjust();
+    }
+
+    void adjust()
+    {
+        if (!source || !dest)
+            return;
+
+        auto line = QLineF(mapFromItem(source, 0, 0), mapFromItem(dest, 0, 0));
+        qreal length = line.length();
+
+        prepareGeometryChange();
+
+        if (length > 20.) {
+            auto edgeOffset = QPointF((line.dx() * 10) / length, (line.dy() * 10) / length);
+            sourcePoint = line.p1() + edgeOffset;
+            destPoint = line.p2() - edgeOffset;
+        } else {
+            sourcePoint = destPoint = line.p1();
+        }
+    }
+
+    enum { Type = UserType + 2 };
+    int type() const { return Type; }
+    
+protected:
+    override QRectF 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);
+    }
+    
+    override void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
+    {
+        if (!source || !dest)
+            return;
+
+        auto line = QLineF(sourcePoint, destPoint);
+        if (qFuzzyCompare(line.length(), 0.))
+            return;
+
+        // Draw the line itself
+        painter.setPen(new QPen(new QBrush(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(new QBrush(Qt.black));
+        auto p1 = new QPolygonF();
+        p1.append(line.p1());
+        p1.append(sourceArrowP1);
+        p1.append(sourceArrowP2);
+        painter.drawPolygon(p1);
+        auto p2 = new QPolygonF();
+        p2.append(line.p2());
+        p2.append(destArrowP1);
+        p2.append(destArrowP2);
+        painter.drawPolygon(p2);        
+    }
+    
+private:
+    Node source, dest;
+
+    QPointF sourcePoint;
+    QPointF destPoint;
+    qreal arrowSize;
+};
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/graphicsview/elasticnodes/graphwidget.d	Thu Jul 08 17:20:02 2010 +0300
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import
+    std.math;
+
+import
+    qt.gui.QLinearGradient,
+    qt.gui.QGraphicsView,
+    qt.gui.QGraphicsScene;
+
+import
+    edge,
+    node;
+
+class GraphWidget : QGraphicsView
+{
+public:
+    this()
+    {
+        auto 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);
+        setResizeAnchor(AnchorViewCenter);
+
+        Node node1 = new Node(this);
+        Node node2 = new Node(this);
+        Node node3 = new Node(this);
+        Node node4 = new Node(this);
+        centerNode = new Node(this);
+        Node node6 = new Node(this);
+        Node node7 = new Node(this);
+        Node node8 = new Node(this);
+        Node node9 = new Node(this);
+        scene.addItem(node1);
+        scene.addItem(node2);
+        scene.addItem(node3);
+        scene.addItem(node4);
+        scene.addItem(centerNode);
+        scene.addItem(node6);
+        scene.addItem(node7);
+        scene.addItem(node8);
+        scene.addItem(node9);
+        scene.addItem(new Edge(node1, node2));
+        scene.addItem(new Edge(node2, node3));
+        scene.addItem(new Edge(node2, centerNode));
+        scene.addItem(new Edge(node3, node6));
+        scene.addItem(new Edge(node4, node1));
+        scene.addItem(new Edge(node4, centerNode));
+        scene.addItem(new Edge(centerNode, node6));
+        scene.addItem(new Edge(centerNode, node8));
+        scene.addItem(new Edge(node6, node9));
+        scene.addItem(new Edge(node7, node4));
+        scene.addItem(new Edge(node8, node7));
+        scene.addItem(new Edge(node9, node8));
+
+        node1.setPos(-50, -50);
+        node2.setPos(0, -50);
+        node3.setPos(50, -50);
+        node4.setPos(-50, 0);
+        centerNode.setPos(0, 0);
+        node6.setPos(50, 0);
+        node7.setPos(-50, 50);
+        node8.setPos(0, 50);
+        node9.setPos(50, 50);
+
+        scale(0.8, 0.8);
+        setMinimumSize(400, 400);
+        setWindowTitle(tr("Elastic Nodes"));        
+    }
+
+    void itemMoved()
+    {    
+        if (!timerId)
+            timerId = startTimer(1000 / 25);
+    }
+    
+protected:
+    void 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(1.2);
+            break;
+        case Qt.Key_Minus:
+            scaleView(1 / 1.2);
+            break;
+        case Qt.Key_Space:
+        case Qt.Key_Enter:
+            foreach (IQGraphicsItem item; scene().items()) {
+                if (cast(Node)item)
+                    item.setPos(-150 + qrand() % 300, -150 + qrand() % 300);
+            }
+            break;
+        default:
+            super.keyPressEvent(event);
+        }
+    }
+    
+    void timerEvent(QTimerEvent event)
+    {
+        Node[] nodes;
+        foreach (IQGraphicsItem item; scene().items()) {
+            if (auto node = cast(Node)item)
+                nodes ~= node;
+        }
+
+        foreach (Node node; nodes)
+            node.calculateForces();
+
+        bool itemsMoved = false;
+        foreach (Node node; nodes) {
+            if (node.advance())
+                itemsMoved = true;
+        }
+
+        if (!itemsMoved) {
+            killTimer(timerId);
+            timerId = 0;
+        }
+    }
+
+    void wheelEvent(QWheelEvent event)
+    {
+        scaleView(pow(cast(float)2, cast(float)(-event.delta() / 240.0)));
+    }
+    
+    void drawBackground(QPainter painter, const QRectF rect)
+    {
+        // Shadow
+        QRectF sceneRect = this.sceneRect();
+        auto rightShadow = QRectF(sceneRect.right(), sceneRect.top() + 5, 5, sceneRect.height());
+        auto bottomShadow = QRectF(sceneRect.left() + 5, sceneRect.bottom(), sceneRect.width(), 5);
+        if (rightShadow.intersects(rect) || rightShadow.contains(rect))
+	    painter.fillRect(rightShadow, Qt.darkGray);
+        if (bottomShadow.intersects(rect) || bottomShadow.contains(rect))
+	    painter.fillRect(bottomShadow, Qt.darkGray);
+
+        // Fill
+        auto gradient = new QLinearGradient(sceneRect.topLeft(), sceneRect.bottomRight());
+        gradient.setColorAt(0, new QColor(Qt.white));
+        gradient.setColorAt(1, new QColor(Qt.lightGray));
+        painter.fillRect(rect.intersected(sceneRect), new QBrush(gradient));
+        painter.setBrush(Qt.NoBrush);
+        painter.drawRect(sceneRect);
+
+        // Text
+        auto textRect = QRectF(sceneRect.left() + 4, sceneRect.top() + 4,
+                        sceneRect.width() - 4, sceneRect.height() - 4);
+        string message = tr("Click and drag the nodes around, and zoom with the mouse "
+                           "wheel or the '+' and '-' keys");
+
+        QFont font = painter.font();
+        font.setBold(true);
+        font.setPointSize(14);
+        painter.setFont(font);
+        painter.setPen(new QColor(Qt.lightGray));
+        painter.drawText(textRect.translated(2, 2), message);
+        painter.setPen(new QColor(Qt.black));
+        painter.drawText(textRect, message);
+    }
+
+    void scaleView(qreal scaleFactor)
+    {
+        qreal factor = matrix().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width();
+        if (factor < 0.07 || factor > 100)
+            return;
+
+        scale(scaleFactor, scaleFactor);
+    }
+
+private:
+    int timerId;
+    Node centerNode;
+
+    mixin Q_OBJECT;
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/graphicsview/elasticnodes/main.d	Thu Jul 08 17:20:02 2010 +0300
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import qt.gui.QApplication;
+
+import graphwidget;
+
+int main(string[] args)
+{
+    auto app = new QApplication(args);
+    qsrand((new QTime(0,0,0)).secsTo(QTime.currentTime()));
+
+    scope widget = new GraphWidget;
+    widget.show();
+    return app.exec();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/examples/graphicsview/elasticnodes/node.d	Thu Jul 08 17:20:02 2010 +0300
@@ -0,0 +1,203 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Nokia.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+module node;
+
+import
+    qt.gui.QRadialGradient,
+    qt.gui.QGraphicsItem;
+
+import
+    graphwidget,
+    edge;
+
+class Node : QGraphicsItem
+{
+public:
+    this(GraphWidget graphWidget)
+    {
+        graph = graphWidget;
+        setFlag(ItemIsMovable);
+        setFlag(ItemSendsGeometryChanges);
+        setCacheMode(DeviceCoordinateCache);
+        setZValue(-1);
+    }
+
+    void addEdge(Edge edge)
+    {
+        edgeList ~= edge;
+        edge.adjust();
+    }
+/*    
+    Edge[] edges() const
+    {
+        return edgeList;
+    }
+*/
+    enum { Type = UserType + 1 };
+    int type() const { return Type; }
+
+    void calculateForces()
+    {
+        if (!scene() || scene().mouseGrabberItem() is this) {
+            newPos = pos();
+            return;
+        }
+    
+        // Sum up all forces pushing this item away
+        qreal xvel = 0;
+        qreal yvel = 0;
+        foreach (IQGraphicsItem item; scene().items()) {
+            auto node = cast(Node)item;
+            if (!node)
+                continue;
+
+            auto line = QLineF(mapFromItem(node, 0, 0), QPointF(0, 0));
+            qreal dx = line.dx();
+            qreal dy = line.dy();
+            double l = 2.0 * (dx * dx + dy * dy);
+            if (l > 0) {
+                xvel += (dx * 150.0) / l;
+                yvel += (dy * 150.0) / l;
+            }
+        }
+
+        // Now subtract all forces pulling items together
+        double weight = (edgeList.length + 1) * 10;
+        foreach (Edge edge; edgeList) {
+            QPointF pos;
+            if (edge.sourceNode() == this)
+                pos = mapFromItem(edge.destNode(), 0, 0);
+            else
+                pos = mapFromItem(edge.sourceNode(), 0, 0);
+            xvel += pos.x() / weight;
+            yvel += pos.y() / weight;
+        }
+        
+        if (qAbs(xvel) < 0.1 && qAbs(yvel) < 0.1)
+            xvel = yvel = 0;
+
+        QRectF sceneRect = scene().sceneRect();
+        newPos = pos() + QPointF(xvel, yvel);
+        newPos.x = qMin(qMax(newPos.x(), sceneRect.left() + 10), sceneRect.right() - 10);
+        newPos.y = qMin(qMax(newPos.y(), sceneRect.top() + 10), sceneRect.bottom() - 10);
+
+    }
+    
+    bool advance()
+    {
+        auto pos_ = pos();
+        if (newPos == pos_)
+            return false;
+
+        setPos(newPos);
+        return true;
+    }
+
+    QRectF boundingRect() const
+    {
+        qreal adjust = 2;
+        return QRectF(-10 - adjust, -10 - adjust,
+                      23 + adjust, 23 + adjust);
+    }
+    
+    QPainterPath shape() const
+    {
+        QPainterPath path;
+        path.addEllipse(-10, -10, 20, 20);
+        return path;
+    }
+    
+    override public void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget = null)
+    {
+        painter.setPen(Qt.NoPen);
+        painter.setBrush(new QBrush(Qt.darkGray));
+        painter.drawEllipse(-7, -7, 20, 20);
+
+        auto gradient = new QRadialGradient(-3, -3, 10);
+        if (option.state & QStyle.State_Sunken) {
+            gradient.setCenter(3, 3);
+            gradient.setFocalPoint(3, 3);
+            gradient.setColorAt(1, (new QColor(Qt.yellow)).lighter(120));
+            gradient.setColorAt(0, (new QColor(Qt.darkYellow)).lighter(120));
+        } else {
+            gradient.setColorAt(0, new QColor(Qt.yellow));
+            gradient.setColorAt(1, new QColor(Qt.darkYellow));
+        }
+        painter.setBrush(gradient);
+        painter.setPen(new QPen(new QBrush(Qt.black), 0));
+        painter.drawEllipse(-10, -10, 20, 20);
+    }
+    
+protected:
+    override QVariant itemChange(GraphicsItemChange change, QVariant value)
+    {
+        switch (change)
+        {
+        case ItemPositionHasChanged:
+            foreach (Edge edge; edgeList)
+                edge.adjust();
+            graph.itemMoved();
+            break;
+        default:
+            break;
+        };
+
+        return QGraphicsItem.itemChange(change, value);
+    }
+
+    override void mousePressEvent(QGraphicsSceneMouseEvent event)
+    {
+        update();
+        QGraphicsItem.mousePressEvent(event);
+    }
+
+    override void mouseReleaseEvent(QGraphicsSceneMouseEvent event)
+    {
+        update();
+        QGraphicsItem.mouseReleaseEvent(event);
+    }
+    
+private:
+    Edge[] edgeList;
+    QPointF newPos;
+    GraphWidget graph;
+};
--- a/generator/typesystem_gui.xml	Thu Jul 08 17:19:05 2010 +0300
+++ b/generator/typesystem_gui.xml	Thu Jul 08 17:20:02 2010 +0300
@@ -1919,7 +1919,7 @@
     </value-type>
 
   <value-type name="QBrush">
-    <modify-function signature="QBrush(Qt::GlobalColor, Qt::BrushStyle)" remove="all"/>
+	<!-- <modify-function signature="QBrush(Qt::GlobalColor, Qt::BrushStyle)" remove="all"/> -->
     <modify-function signature="operator=(const QBrush &amp;)" remove="all"/>
 	<!-- restore later - abstract class not handled-->
 	<modify-function signature="gradient() const" remove="all"/>
@@ -6145,6 +6145,7 @@
         <modify-argument index="1">
             <!-- Safe to ignore because button is reparented -->
             <reference-count action="ignore"/>
+
         </modify-argument>
     </modify-function>
     <modify-function signature="setLabel(QLabel*)">