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. Delegate for a cell

Delegate for a cell

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.9k 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.
  • Z Offline
    Z Offline
    Zhenya
    wrote on last edited by
    #1

    Hello, everybody!

    I have my own delegate and want to use it for a specific cell in a table view. I've already found methods setItemDelegate, setItemDelegateForRow/Column.
    Any thoughts how to set it for a specific cell? (e.g. (i,j) )

    1 Reply Last reply
    0
    • raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      subclass QStyledItemDelegate and check the index for your specific (i,j).
      If the index is your (i,j) do what you want to do for this cell else call the base classes implementation.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        Zhenya
        wrote on last edited by
        #3

        I've used setIndexWidget, but setData is not called in my model. Does anyone know why?

        1 Reply Last reply
        0
        • raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          such questions are impossible to answer without showing code at all

          setIndexWidget method has nothing todo with the model. since it is only suposed to show static content

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          0
          • Z Offline
            Z Offline
            Zhenya
            wrote on last edited by
            #5

            OK, more informative:

            I have a Model : AbstractItemModel, I have a table view, and I want to use my method for showing for example numbers. I dont want to use the default widget to show them, I do not want to use default delegate.

            I've create my own delegate to operate on them.

            The quiestion is:

            1. how to set a delegate for a specific cell cause I've found only for a row and for a column or for all table.
            2. do I need to use indexWidget to specify my widget to show numbers or editor in the delegate class is all that I need?
            3. what the point in indexWidget if it doesn't change the model? Why is it created? If I write "setIndexWidget(..., new QLineEdit)" like in Manual and it doesnt change the real data why I need it? only like a toy?
            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              Zhenya
              wrote on last edited by
              #6

              http://harmattan-dev.nokia.com/docs/platform-api-reference/xml/daily-docs/libqt4/itemviews-stardelegate.html

              solved

              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