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



  • 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.



  • 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



  • 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..



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.