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. Qtableview

Qtableview

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 4 Posters 1.1k Views
  • 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.
  • AmoghA Offline
    AmoghA Offline
    Amogh
    wrote on last edited by
    #1

    How do i make a particular column of a Qtableview model editable ?

    joeQJ 1 Reply Last reply
    -1
    • AmoghA Amogh

      How do i make a particular column of a Qtableview model editable ?

      joeQJ Offline
      joeQJ Offline
      joeQ
      wrote on last edited by joeQ
      #2

      @Amogh hi,friend,welcome.

      you can use the editorfactory for same value type cell item. and delegate for column.

      particular value type

      Qt Itemviews color editor factpry

      editable just for column

      Two ways:

      1. when you new cell item, set the item is editable.
      2. set delegate just for this column, and you should to finished new editor widget in delegate.model-view-delegate

      Just do it!

      1 Reply Last reply
      0
      • dheerendraD Offline
        dheerendraD Offline
        dheerendra
        Qt Champions 2022
        wrote on last edited by
        #3

        By default it is editable only. It shows you the lineEdit by default. Any other specific stuff r u trying to do ?

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          It's not just up to the View.

          • You can make sure the view has some edit triggers set: http://doc.qt.io/qt-5/qabstractitemview.html#editTriggers-prop
          • The delegate has to handle the editing (this only applies if you set a custom delegate)
          • The model flags() method must return a value with Qt::ItemIsEditable set and its setValue method must actually do something rather than just returning false

          For example, if you are trying to edit a QSqlQueryModel via a QTableView you won't be successful as the 3rd point is failing

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          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