Drag and Drop with QT C++ Application

Hi everyone, we are going to talk about how can we enable and use drag and drop in our QT GUI C++ program. I need to say: I will use QT 5.11.3 version. Let’s begin to work.

First we need to enable the Accepting Drops in the form. We can make it via the Qt Form Designer Interface or code.

And here to image to set this property with the form designer of the QT Creator.

By activating the dropping files into the form we need to set “Whet our program will do when a file dropped?”

There are two override methods belongs to QT C++.

Now we are ready to use Drag and Drop in QT C++.

That is all.

Have a nice coding.

Burak Hamdi Tufan

LEAVE A REPLY

Please enter your comment!
Please enter your name here