Quote Originally Posted by wysota View Post
Your code has a lot of problems such as this:
Qt Code:
  1. void MainWindow::paintEvent(QPaintEvent*)
  2. {
  3. QPainter painter(this);
  4. QPen pen(Qt::gray, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
  5. painter.setPen(pen);
  6. ui->graphicsView->setScene(m_scene);
  7. }
To copy to clipboard, switch view to plain text mode 
Adding items in mouse move events is probably a bad idea as well. Spaghetti code doesn't help too, try simplifying it.

As for your problem - if you want to make items movable, you don't need to use drag and drop, that's for something else. You can make items movable by setting the ItemIsMovable flag on the item and making sure the scene has a chance to process mouse events (that is if you reimplement mouse event handlers, be sure to call the base class implementation).
I can understand that my code looks bad. I have just used it to try some stuff out and there are some stuff left that I am not using like the code you pointed out. But your explenation helps alot. I am gonna try so simplify it and set the flags to se if it works out. Thanks alot Zen Master