stefan
7th August 2008, 16:40
hi,
i draw a line in QGraphicsScene, which can be selected and moved.
MainPlot=new QGraphicsScene(centralWidget());
MainPlot->setSceneRect(0,0,500,500);
QPen _Pen;
_Pen.setColor(Qt::red);
_Pen.setWidth(3);
QGraphicsLineItem* _Line=new QGraphicsLineItem(100,100,450,300);
_Line->setPen(_Pen);
_Line->setVisible(true);
_Line->setFlags(QGraphicsLineItem::ItemIsSelectable | QGraphicsLineItem::ItemIsMovable);
MainPlot->addItem(_Line);
ui.view->setScene(MainPlot);
//ui.view is raphicsView
But i don't want that when line is selected, a rectangular is drawn (and line is its diagonal). I want line selection like in "diagramscene" example supplied with Qt documantation (thin rectangular paralel with line), or some custom selection style. How to do that? I can't find this in diagramscene source.
Thanx
i draw a line in QGraphicsScene, which can be selected and moved.
MainPlot=new QGraphicsScene(centralWidget());
MainPlot->setSceneRect(0,0,500,500);
QPen _Pen;
_Pen.setColor(Qt::red);
_Pen.setWidth(3);
QGraphicsLineItem* _Line=new QGraphicsLineItem(100,100,450,300);
_Line->setPen(_Pen);
_Line->setVisible(true);
_Line->setFlags(QGraphicsLineItem::ItemIsSelectable | QGraphicsLineItem::ItemIsMovable);
MainPlot->addItem(_Line);
ui.view->setScene(MainPlot);
//ui.view is raphicsView
But i don't want that when line is selected, a rectangular is drawn (and line is its diagonal). I want line selection like in "diagramscene" example supplied with Qt documantation (thin rectangular paralel with line), or some custom selection style. How to do that? I can't find this in diagramscene source.
Thanx