[SOLVED] Editable Proxy Model

  • EDIT: By comparing my model to http://blog.qt.digia.com/blog/2012/01/12/qt-commercial-support-weekly-10-sorting-filtering-and-advanced-manipulation-with-proxy-models-2/ I noticed I had an error in my index function which caused the the problem.


    I have been toying with custom models and custom proxy models inheriting from QAbstractItemModel and QAbstractProxyModel classes. It works but I cannot seem to get my proxy models to become editable. It does not matter whether I use standard QStandardItemModel as source or my custom model, both can be edited when set to views but when the proxy is set they cannot be.

    In my proxy class I re-implemented:


    I figured I need to re-implement functions for editing just like any QAbstractItemModel sub-class so I added:


    but it did not help and the model is still just read-only. I tried returning the Qt::ItemIsEditable directly from proxy bypassing the source model items flags but to no avail. Do I need to re-implement mapSelectionFromSource() and mapSelectionToSource() for editable proxy model? Or am I missing something else here? If it should work by re-implementing the functions I mentioned I will post my code but first I need to make sure I am not missing something obvious (and convoluting the post with lots of code would not help there).


Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.