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

QDataWidgetMapper manual submit



  • I have a huge problem with trying QDataWidgetMapper to work in manual submit mode. In the set method of my abstract model I always end up getting the old value of each mapped widget.

    Changing the submit policy to auto solves the issue when I manually call .submit() slot on the QDataWidgetMapper.
    Of course I have my own 'apply' button which I need to do it instead. SO not sure why I am getting old values only when manual submit policy in place.

    One thing I observed is that the data (get method) of my abstract model is called before call to set(). That is weird and might explain why I am getting old values because the get fetched from the model rather than from the widgets mapped via QDataWidgetMapper ?

    this is extremely confusing and frustrating, someone please?


  • Lifetime Qt Champion

    Hi,

    Can you provide a minimal sample application that reproduce this behavior ?



  • DISREGARD!

    Indeed there was something fishy with the abstract model. It seems if I invaldiate the model during one of the many calls to setData I end up getting the wrong value in the QVariant of setData. No idea why that might be the case, require some more qt internals knowledge. Somehow strange and unexpected but I got along it by simply rearranging the mapper fields, now order does matter for this particular case.


Log in to reply