ok i was able t get the rubberband t work but though ive used QRubberBand::Line i still get a rectangle wen i click and drag. what should i do to get a line??
if (event->type() == QEvent::MouseMove)
{
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
if (rubber)
rubberBand->setGeometry(QRect(origin,mouseEvent->pos()).normalized());
}
if (event->type() == QEvent::MouseButtonPress)
{
if(c==0)
{
QMouseEvent *mouseEvent1 = static_cast<QMouseEvent*>(event);
if(mouseEvent1->button()==Qt::LeftButton)
{
origin = mouseEvent1->pos();
rubberBand->setGeometry(QRect(origin, QSize()));
rubberBand->show();
rubber = true;
}
}
else
{
c=0;
rubber = false;
rubberBand->hide();
}
Bookmarks