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. Problems with QstandardItem and setFlags
Forum Updated to NodeBB v4.3 + New Features

Problems with QstandardItem and setFlags

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.8k 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.
  • L Offline
    L Offline
    LiamMaru
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      LiamMaru
      wrote on last edited by
      #2

      This works:

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

      And of rid of the flags in my item classes.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        koahnig
        wrote on last edited by
        #3

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

        Vote the answer(s) that helped you to solve your issue(s)

        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