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. Item view (delegate and editor)
Forum Updated to NodeBB v4.3 + New Features

Item view (delegate and editor)

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 1.8k 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
    Immii
    wrote on last edited by
    #1

    I have to have my own set editors ( custome combo Box) in several cells of QTableView so I have called openPersistentEditor() to keep these editors always open.

    Now again some button hit I need to select some other item of this comboBox and also change the text color. Obviously I need the pointer of the comboBox shown in each cell. I have the index of the cell whose pointer i want but i just dont know how to get this pointer?
    Can any one please help using the index of the cell how do i get the pointer of the editor (editor is opened not closed)

    Thanx

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Mystery Keeper
      wrote on last edited by
      #2

      Can not answer your question. But I can not imagine why would you need several persistent editors. You just need to set item delegate, and it will call needed editor every time you edit exact cell.

      1 Reply Last reply
      0
      • JeroentjehomeJ Offline
        JeroentjehomeJ Offline
        Jeroentjehome
        wrote on last edited by
        #3

        Huh,
        bq. Obviously I need the pointer of the comboBox shown in each cell.
        The view keeps track of the pointers for you. You get the index you are, that's it and that's enough. For every instance the view keeps the pointer. In you delegate class reimplement the createEditor and setEditordata function to comply with it. In the createEditor set the elements of the combobox. the setEditorData function is called when the item is changed, so your able to set a different colour.
        Using the index.model()->data(index....) function you can analyse the data in the model for the corresponding index. So if the colour is dependent of the model data, do it like that. Otherwise, overwrite the paint event.
        Hope this gets you started

        Greetz, Jeroen

        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