Movable graphics items

In the previous example, we have successfully drawn some simple shapes and text onto the Graphics View widget. However, these graphics items are not interactive and thus don't suit our purpose. What we want is an interactive organization chart where the user can move the items around using mouse. It is actually really easy to make these items movable under Qt; let's see how we can do that by continuing our previous project.

First, make sure you don't change the default interactive property of our Graphics View widget, which is set to enabled (checkbox is checked):

After that, add the following code below each of the ...

Get Hands-On GUI Programming with C++ and Qt5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.