Results 1 to 3 of 3

Thread: Qt table cell coloring

  1. #1

    Default Qt table cell coloring

    What would be the best way to manage the coloring (background color and border color/style) of a particular cell? I would like to create the appearance of merged cells.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Qt table cell coloring

    A particular cell in a QTableView? QTableView already supports cell spanning (see QTableView::setSpan()), are you sure you need to fake it.

    The background colour for a cell comes, by default, from the data the model returns for the Qt::BackgroundRole. It can be manipulated by a delegate attached to the view.

  3. #3

    Default Re: Qt table cell coloring

    Quote Originally Posted by ChrisW67 View Post
    A particular cell in a QTableView? QTableView already supports cell spanning (see QTableView::setSpan()), are you sure you need to fake it.

    The background colour for a cell comes, by default, from the data the model returns for the Qt::BackgroundRole. It can be manipulated by a delegate attached to the view.
    Yes, I do not need the actual cells to be merged. I just want to paint a grid rectangle around them to give off that appearance for style purposes. I am familiar with Qt::Background role within the data() function of AbstractTableView but I am not sure how to relate that to the task at hand?

Similar Threads

  1. Set Table Cell Color based off Value
    By Sarol in forum Newbie
    Replies: 3
    Last Post: 12th May 2011, 16:44
  2. Trouble coloring table view rows
    By waynew in forum Qt Programming
    Replies: 11
    Last Post: 30th August 2010, 14:38
  3. QTreeView cell as table
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 26th June 2009, 09:45
  4. Making Table cell as a combobox?
    By kaushal_gaurav in forum Qt Programming
    Replies: 9
    Last Post: 1st August 2008, 12:04
  5. Table cell merge/join
    By larry104 in forum Qt Programming
    Replies: 6
    Last Post: 16th June 2006, 22:35

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.