Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. TableView cell coloring
Forum Updated to NodeBB v4.3 + New Features

TableView cell coloring

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 905 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cubesnyc
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      i92guboj
      wrote on last edited by
      #2

      I haven't played with borders ever.

      QTableView has a setShowGrid(bool) method, but that won't help you unless you want to take rid of all borders. Some people do that, and then put some of them back on by using style sheets. As said I haven't ever toyed with that, but I doubt the result will be very good.

      I'd look into using a QStyledItemDelegate (or QSortFilterProxyModel) subclass with the QTableView.

      For the background, you can reimplement QStyledItemDelegate::data using the Qt::Background role. I am not too sure how to proceed about borders though. Sorry :(

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved