Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [SOLVED] Editable Proxy Model
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Editable Proxy Model

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 983 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Resurrection
    wrote on last edited by
    #1

    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.

    Hi,

    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:

    @
    mapFromSource()
    mapToSource()
    index()
    parent()
    columnCount()
    rowCount()
    @

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

    @
    data()
    setData()
    flags()
    @

    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).

    Thanks!

    Secrets are power.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved