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. QStyledItemDelegate on a QTableView problem
Qt 6.11 is out! See what's new in the release blog

QStyledItemDelegate on a QTableView problem

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

    Hi all,

    I have a curious problem when using QStyledItemDelegate class on a QTableView. In fact I started from wiki snippets 'Combo Boxes in Item Views', except than my Qtable is not a QTableWidget but a QTableView populated by a QAbstractTableModel.

    All is working fine except when I try enter edit mode (by dbclick for ex) the function createEditor() of the delegate class is never called although editTriggers are set to AllEditTriggers.

    I must forget something to make the tableView editable, but what ?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Have you implemented a correct flags() function for your model? Same for setData()? Have you tried your model with the qmodeltest program to check for other common mistakes?

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        Hi quadbyte,

        did you try whether your model is editable, without your custom delegate?
        That could deliver a first idea, where to search for the bug.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          quadbyte
          wrote on last edited by
          #4

          @ZapB, I check yours points.
          @Gerolf,
          You are correct Gerolf, I was not clear in my initial mail, but my Model seems to be not editable (even without custom Delegate).

          I read the Qt doc to see how to make a Model editable...

          Thanks a lot Guys for you help

          1 Reply Last reply
          0
          • G Offline
            G Offline
            giesbert
            wrote on last edited by
            #5

            Let me give you a hint:

            "an editable model":http://doc.qt.nokia.com/4.7/model-view-programming.html#an-editable-model

            The points are the method flags and setData.

            Nokia Certified Qt Specialist.
            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              [quote author="Gerolf" date="1304668939"]
              The points are the method flags and setData.[/quote]

              Just like I mentioned ;-)

              1 Reply Last reply
              0
              • Q Offline
                Q Offline
                quadbyte
                wrote on last edited by
                #7

                It's working, thanks a lot

                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