Hi I'm doing a Widget that uses arrows, I have a arrow in a QPolygon and I want to clone and rotate it to create the other arrows.
Some help?
Thanks
Hi I'm doing a Widget that uses arrows, I have a arrow in a QPolygon and I want to clone and rotate it to create the other arrows.
Some help?
Thanks
You can rotate a QPolygon by QMatrix::map() more or less like this:
Qt Code:To copy to clipboard, switch view to plain text mode
J-P Nurmi
xgoan (27th October 2006)
Hi,
I am doing one application in which, i wrote one class A to create different shapes of polygons. Then i wrote another class B for creating a special polygon which i have to attach with polygons of class A dynamically. Before i did somethinig similar but with QGraphicsItem class using setPos() function for attaching one polygon with another. But with QPolygon, it is working similar. Please suggest me some way.
Regards
Rohit
This is the constructor of class A
A::A(DiagramType diagramType, QMenu *contextMenu,
QGraphicsItem *parent, QGraphicsScene *scene)
: QGraphicsPolygonItem(parent, scene)
{
myDiagramType = diagramType;
myContextMenu = contextMenu;
QPainterPath path;
switch (myDiagramType) {
case StartEnd:
path.moveTo(200, 50);
path.arcTo(150, 0, 50, 50, 0, 90);
path.arcTo(50, 0, 50, 50, 90, 90);
path.arcTo(50, 50, 50, 50, 180, 90);
path.arcTo(150, 50, 50, 50, 270, 90);
path.lineTo(200, 25);
myPolygon = path.toFillPolygon();
break;
case Conditional:
myPolygon << QPointF(-100, 0) << QPointF(0, 100)
<< QPointF(100, 0) << QPointF(0, -100)
<< QPointF(-100, 0);
break;
case Step:
myPolygon << QPointF(-100, -100) << QPointF(100, -100)
<< QPointF(100, 100) << QPointF(-100, 100)
<< QPointF(-100, -100);
break;
default:
myPolygon << QPointF(-120, -80) << QPointF(-70, 80)
<< QPointF(120, 80) << QPointF(70, -80)
<< QPointF(-120, -80);
break;
}
anditem = new AndItem();
///// What code to write to attach andItem->myPolygon to myPolygon of this class.////
setPolygon(myPolygon);
setFlag(QGraphicsItem::ItemIsMovable, true);
setFlag(QGraphicsItem::ItemIsSelectable, true);
}
You already posted here
http://www.qtcentre.org/forum/f-qt-p...gons-6909.html
Bookmarks