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. How to disable editing in QTableView

How to disable editing in QTableView

Scheduled Pinned Locked Moved General and Desktop
5 Posts 5 Posters 13.0k 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.
  • I Offline
    I Offline
    Indrajeet
    wrote on last edited by
    #1

    Hi All

    I have created a QTableView & I m using the different table view with same model in 2 different tabs.
    Here I want set different FLAG property[i.e enable & disable] to my table view located in 2 different tabs.
    How to achieve this?

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fluca1978
      wrote on last edited by
      #2

      Does this solve the problem?

      @tableView.setEditTriggers(QAbstractView::NoEditTriggers);@

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        That works. If you want to have more detailed control, you will need to use a proxy model and modify the editable flags in there.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          broadpeak
          wrote on last edited by
          #4

          If you don't use the "setData" on the model, that will be read-only. And don't add the "Qt::ItemIsEditable" to the flags.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            pasomas
            wrote on last edited by
            #5

            [quote author="fluca1978" date="1320833028"]Does this solve the problem?

            @tableView.setEditTriggers(QAbstractView::NoEditTriggers);@
            [/quote]

            I think is

            @tableView.setEditTriggers(QAbstractItemView::NoEditTriggers);@

            1 Reply Last reply
            1

            • Login

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