Hi
I have created a polygon using PolygonF class in a Graphics Scene. Now i want to use that polygon as a button/push button to perform or trigger some event.
I am not able to figure out how can I use the full area of the polygon as a button.
Any help is welcome.
scene = new QGraphicsScene(0, 0, 730, 500, this);
view = new QGraphicsView(scene, this);
item = view->itemAt(130, 50);
QPolygonF poly1;
poly1 << QPointF(110, 80) << QPointF(170, 80) << QPointF(200, 130) << QPointF(170, 180) << QPointF(110, 180) << QPointF(80, 130) ;
scene->addPolygon( poly1 , QPen(brush1, 1, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin), QBrush(QColor(Qt::white)));
QLinearGradient linearGradient(0, 0, 100, 100);
linearGradient.setColorAt(0, QColor(140, 140, 140, 255));
scene->setBackgroundBrush(linearGradient);
view->setScene(scene);
view->show();
Thanks and Regards
Manish.S
Bookmarks