From Qt Wiki
Revision as of 15:13, 14 January 2015 by Maintenance script
Small snippet showing how to override dropEvent method on a custom QListWidget.
- First create a Qt Gui Application using Qt Creator and add a QListWidget to it.
- Create the below given MyListWidget.h and MyListWidget.cpp files.
- Right click on the QListWidget created in the Form designer and Promote it to MyListWidget
- When you run the application, if you drop something on MyListWidget, you will first see the debug msg (dropEvent of MyListWidget), and then it calls the dropEvent of the QListWidget …
The header file
The cpp file