Results 1 to 4 of 4

Thread: QTableWidget - images in columns

  1. #1
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default QTableWidget - images in columns

    Hello,
    I want to display images in columns of my QTableWidget instead of text.

    How do I do this? Using setIcon() only sets the icon and is not large enough.

    Does QTableWidget support images as cell data or should I use another type of widget?
    - BRC

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget - images in columns

    Try using setCellWidget, and pass a simple, custom widget, that has the size hint of the pixmap being painted on it.

    Regards

  3. #3
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QTableWidget - images in columns

    You may want to override, the QHeaderView etc. Also AbstractItemView too.

  4. #4
    Join Date
    Jan 2007
    Posts
    91
    Thanks
    21
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: QTableWidget - images in columns

    Thanks. I didn't know about that api. I will just set the text on a label and then display that in the table.
    - BRC

Similar Threads

  1. Example code for QTableWidget with images
    By bruccutler in forum Newbie
    Replies: 4
    Last Post: 12th May 2008, 14:07
  2. QTableWidget columns to expand to window size
    By bruccutler in forum Newbie
    Replies: 1
    Last Post: 13th April 2007, 16:02
  3. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 18:46
  4. Maximize columns on QTableWidget
    By marcelrc in forum Newbie
    Replies: 1
    Last Post: 21st May 2006, 15:34
  5. Replies: 6
    Last Post: 5th March 2006, 21:05

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.