Results 1 to 5 of 5

Thread: Different delegates to different Columns of QTableView.

  1. #1
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Different delegates to different Columns of QTableView.

    Hi,

    How can i apply different delegates to different columns of QTableView.
    I have a QTableView of two Columns (say col_1 and col_2)
    Now i have to put comboBox in each cell of col_1 and col_2 but the data of comboBox in col_1 differ from data in comboBox of col_2.
    The data is to be read from the Modal.

    Please help

  2. #2
    Join Date
    Aug 2008
    Location
    Prague
    Posts
    8
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Different delegates to different Columns of QTableView.

    Hi,

    I beleave this can help you. Just create different delegate classes and then use QTableView::setItemDelegateForColumn.

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Different delegates to different Columns of QTableView.

    I dont think u will need to use different delegates. You can use internalPointer for a given index to retrieve the data for populating the combobox

  4. #4
    Join Date
    Jun 2008
    Posts
    89
    Thanks
    1
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Different delegates to different Columns of QTableView.

    if i use QTableView::setItemDelegateForColumn then inside CreateEditor function i can not find for which row i need to populate the combo....

    aamer4yu - How can i use internal pointer?
    When would in put data inside the internal pointer?

    Some example!

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Different delegates to different Columns of QTableView.

    You may refer to Simple DOM Model or Simple Tree Model in the Qt Demos.
    You will get some idea how to store data of ur own type via internalPointer

Similar Threads

  1. Width QTableView for QCombobox with multiple columns
    By visor_ua in forum Qt Programming
    Replies: 7
    Last Post: 21st June 2011, 10:54
  2. set the width of the columns of QTableView
    By zhanglr in forum Qt Programming
    Replies: 6
    Last Post: 31st July 2008, 15:29
  3. autoexpanding QTableView columns
    By ucntcme in forum Qt Programming
    Replies: 6
    Last Post: 11th March 2008, 09:28
  4. Ensure columns in qtableview uses all available space
    By oysteinpettersen in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2008, 11:28
  5. QTableView - Enable Clicking for some columns only
    By Gabriel in forum Qt Programming
    Replies: 1
    Last Post: 23rd June 2006, 22:42

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.