Results 1 to 6 of 6

Thread: Tableview dialog as delegate

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    45
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Tableview dialog as delegate

    I am trying to create a button delegate in the first column of a tableview that launches a dialog to edit the data in the row of the button.

    I get the delegate button. But, since setEditorData is not called by the clicked event of the button, I don't see how to get the data to fill in on the dialog.

    I can't see that the clicked event has access to the index or the model.

    Can anyone give me some tips or point me to an example?

    All the examples I've found are either just creating a button delegate or a spin box for a particular cell of the table.

    Regards,
    Mac
    Last edited by drmacro; 25th October 2015 at 19:03.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Tableview dialog as delegate

    Please verify that setEditorData() is not called at all, it should be called when the cell becomes editable and when the cell contents change while it is editable.

    Cheers,
    _

  3. #3
    Join Date
    Oct 2015
    Posts
    45
    Thanks
    8
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Tableview dialog as delegate

    Well I have print statements in setEditorData(). They only print when each of the delegate buttons gets created.

    But, not when I click the button.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Tableview dialog as delegate

    Why would the setEditorData() method be called when you click the button?

    Clicking the button doesn't change anything in the model, does it?
    The data didn't change since the last time the delegate was informed about data change.
    So why would the view need to call setEditorData() again?

    How does your slot look like that you have connected to the button's clicked() signal?

    Cheers,
    _

Similar Threads

  1. Issue with custom delegate in tableview
    By alizadeh91 in forum Qt Programming
    Replies: 4
    Last Post: 13th April 2013, 08:39
  2. Button Delegate Problem in TableView
    By alizadeh91 in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2013, 17:13
  3. Replies: 4
    Last Post: 22nd September 2010, 22:34
  4. Replies: 14
    Last Post: 19th March 2007, 08:48
  5. TableView Delegate questions
    By No-Nonsense in forum Qt Programming
    Replies: 3
    Last Post: 11th December 2006, 09:39

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.