Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    QStyledItemDelegate on a QTableView problem

    General and Desktop
    3
    7
    3560
    Loading More Posts
    • 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
      quadbyte last edited by

      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 Reply Quote 0
      • Z
        ZapB last edited by

        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?

        Nokia Certified Qt Specialist
        Interested in hearing about Qt related work

        1 Reply Last reply Reply Quote 0
        • G
          giesbert last edited by

          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 Reply Quote 0
          • Q
            quadbyte last edited by

            @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 Reply Quote 0
            • G
              giesbert last edited by

              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 Reply Quote 0
              • Z
                ZapB last edited by

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

                Just like I mentioned ;-)

                Nokia Certified Qt Specialist
                Interested in hearing about Qt related work

                1 Reply Last reply Reply Quote 0
                • Q
                  quadbyte last edited by

                  It's working, thanks a lot

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post