QStyledItemDelegate on a QTableView problem



  • Hi all,

    I have a curious problem when using QStyledItemDelegate class on a QTableView. In fact I started from wiki snippets 'Combo Boxes in Item Views', except than my Qtable is not a QTableWidget but a QTableView populated by a QAbstractTableModel.

    All is working fine except when I try enter edit mode (by dbclick for ex) the function createEditor() of the delegate class is never called although editTriggers are set to AllEditTriggers.

    I must forget something to make the tableView editable, but what ?



  • Have you implemented a correct flags() function for your model? Same for setData()? Have you tried your model with the qmodeltest program to check for other common mistakes?



  • Hi quadbyte,

    did you try whether your model is editable, without your custom delegate?
    That could deliver a first idea, where to search for the bug.



  • @ZapB, I check yours points.
    @Gerolf,
    You are correct Gerolf, I was not clear in my initial mail, but my Model seems to be not editable (even without custom Delegate).

    I read the Qt doc to see how to make a Model editable...

    Thanks a lot Guys for you help



  • Let me give you a hint:

    "an editable model":http://doc.qt.nokia.com/4.7/model-view-programming.html#an-editable-model

    The points are the method flags and setData.



  • [quote author="Gerolf" date="1304668939"]
    The points are the method flags and setData.[/quote]

    Just like I mentioned ;-)



  • It's working, thanks a lot


Log in to reply
 

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