C++ (Qt)Dialog::Dialog(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog){ ui->setupUi(this); QGraphicsScene *scene=new QGraphicsScene; ui->graphicsView->setScene(scene); QGraphicsLineItem* pLineItem=ui->graphicsView->scene()->addLine(20,15,50,80,QPen(Qt::red,2)); pLineItem->setFlags(QGraphicsItem::ItemIsMovable);}