Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to debug into Qt libraries why derived dropMimeData is not being invoked?



  • Hello,
    To solve a problem I need to have my derived dropMimeData be called by the underlying Qt framework. My situation: I have QTableView that is using a custom model derived from QAbstractTableModel.

    I have set all the necessary properties on the QTableView for drag/drop. When I move a row within the table, I want to invoke the code in my derived dropMimeData.

    After having poured through the various issues on the net, and also trying for hours, I cannot figure out why my derived dropMimeData is not being called when a row is moved within the table. If I could set breakpoints in the QAbstractTableModel methods, this problem would be so easy to solve.

    How can I pull all the Qt classes into the project, in such a way that I can set breakpoints in them?

    Thanks.


  • Lifetime Qt Champion

    Hi,

    Might be a silly question but did you also setup your views correctly for drag and drop ?
    If so, did you use the override keyword in your subclass ? It will make the compiler scream if you have the signature wrong because you'll be overriding a non-existing method.



  • SGaist, a huge thanks for your tip.

    I combed through my code, and through all the samples. Finally found a difference that resolved the issue:

    I was doing:

    qTableView->verticalHeader()->setDragEnabled(true);
    

    After adding the following line, now my derived dropMimeData is getting invoked.

    qTableView->setDragEnabled(true);
    

    Even though this resolves my issue, I still would like to figure out how to attach all the Qt framework source code. Debugging/stepping is a great way to learn frameworks. In the hopes of getting some guidance on how to attach the Qt framework source, I will leave this request open for a little bit. I am searching too. If I find a way, I will definitely post it here.


  • Lifetime Qt Champion

    @JohnGa have you installed the Qt sources with MaintenanceTool?


Log in to reply