Results 1 to 2 of 2

Thread: Lists/multiline text in QTableView cells

  1. #1
    Join Date
    Feb 2008
    Posts
    12

    Default Lists/multiline text in QTableView cells

    Hello,

    I have a problem regarding the QTableView cells. The model provides QStrings for the first 3 columns - but the data for the 4th is a string list, not just a string.

    Now, I see two options:

    1) Put a combobox in the 4th column cells. Like here: http://doc.trolltech.com/4.3/images/icons_monkey.png
    However, I do not know how. Using delegates maybe? But the delegates have a paint() call, no "widget()" method or something similar.

    2) Display multiline text in the cells. Unfortunately, the standard delegate does not understand \n and \r characters, and displays the entire thing as one long string.

    Any ideas?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Lists/multiline text in QTableView cells

    Quote Originally Posted by dv_ View Post
    2) Display multiline text in the cells. Unfortunately, the standard delegate does not understand \n and \r characters, and displays the entire thing as one long string.
    You can subclass the delegate and make it display multiline text for that column.

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Text in QTableView cells not visible
    By juliarg in forum Newbie
    Replies: 2
    Last Post: 22nd March 2007, 15:49
  3. Editable cells in QTableView
    By TheRonin in forum Qt Programming
    Replies: 1
    Last Post: 29th November 2006, 17:39

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.