Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. how to set the color of row numer that is diffrent with table header?
Forum Updated to NodeBB v4.3 + New Features

how to set the color of row numer that is diffrent with table header?

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 256 Views
  • 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.
  • H Offline
    H Offline
    Harning
    wrote on last edited by
    #1

    how to set the color of row numer that is diffrent with table header?

    JonBJ 1 Reply Last reply
    0
    • H Harning

      how to set the color of row numer that is diffrent with table header?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Harning
      Hello and welcome.

      Your question is unclear: what does "diffrent with table header" mean?

      If you have a model, and you are using, say, a QTableView to display it, one way is to use QVariant QAbstractItemModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const where for role == Qt::ForegroundRole or perhaps Qt::BackgroundRole you make it return the desired color. If the color varies by row number you can look at the passed in index.row() to determine which color to return.

      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