Nominate our 2022 Qt Champions!

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:


    And of rid of the flags in my item classes.

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

Log in to reply