Problems with QstandardItem and setFlags



  • I might be having a bad day today, but I can't for the life of me figure this out. I'm trying to build a quick model using a QStandardItemModel, and it need sto be read only. in the constructor for my items (which inherit from QStandardItem), I'm calling setFlags like so:

    @ setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);@

    However, when I double click the items displayed in a QTreeView, they still go into an edit mode. What am I missing here?



  • This works:

    @
    TreeView->setEditTriggers(QAbstractItemView::NoEditTriggers);@

    And of rid of the flags in my item classes.


  • Moderators

    Is your problem solved now?
    If so, please mark it with [Solved] in the subject line.


Log in to reply
 

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