hi friends ,
i need a help to clarify my doubt in QLineF() .. i dont know where i am commiting the mistake ..
in mainwindow.cpp (QGraphicsView())
i create a line item class ....
line1
= new LineItem
(QLineF(2,
4,
132 ,
160), Qt
::blue);
line1->setPos(374,215);
line1 = new LineItem(QLineF(2,4, 132 ,160), Qt::blue);
line1->setPos(374,215);
To copy to clipboard, switch view to plain text mode
and
in lineitem.cpp
LineItem
::LineItem(const QLineF &line,
const Qt
::GlobalColor color
) color(color)
{
painter
->setPen
(QColor(color
));
QReal value = 90;
line().setAngle(value);
painter->drawLine(line());
}
LineItem::LineItem(const QLineF &line, const Qt::GlobalColor color)
: QGraphicsLineItem(line),
color(color)
void LineItem ::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
{
painter->setPen(QColor(color));
QReal value = 90;
line().setAngle(value);
painter->drawLine(line());
}
To copy to clipboard, switch view to plain text mode
here the line is drawn perfectly but i cant fix the angle ... its not turning in counter clockwise ... not like transform.rotate .. why ?
please help ...
Bookmarks