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. Style a QTableView's cells to look like Header sections?
Forum Updated to NodeBB v4.3 + New Features

Style a QTableView's cells to look like Header sections?

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.3k 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.
  • G Offline
    G Offline
    geracmos
    wrote on last edited by
    #1

    Is it possible to style a QTableView's cells to look like Headers?

    I am trying to implement a QTableView that will act like a header for another QTableView.
    This is because I need a multiple-level header for my tableView.
    Is there a way that I could make this QTableView look exactly like a header?
    Including the State_Sunken / State_On behavior.
    At the moment I am looking at QStyleOptionViewItem but I am a bit confused with this.

    Thanks in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbnoimi
      wrote on last edited by
      #2

      Theoretically it's possible but may you share a snippet of your qss?

      P.S. Don't forget to take a look into: https://qt-project.org/doc/qt-5.0/qtwidgets/stylesheet-examples.html#customizing-qtableview

      1 Reply Last reply
      0
      • G Offline
        G Offline
        geracmos
        wrote on last edited by
        #3

        I don't want to render the cells using a style sheet, because it seems to be quite difficult to make them look exactly the same with the Header sections.
        I have been trying to do that using the QStyleOptionHeader and casting it somehow to QStyleOptionViewItem, but with no success..Do you think that I'm just losing my time with that?

        I am new to Qt, so maybe what I try is a bit fullish..Don't know..

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mbnoimi
          wrote on last edited by
          #4

          Personally I always use stylesheets unless they couldn't fit my needs then I turn around to customize a new style by C++

          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