Results 1 to 6 of 6

Thread: QHeaderView: background of selected header item with CSS

  1. #1
    Join Date
    Jun 2009
    Posts
    11
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QHeaderView: background of selected header item with CSS

    Hi CSS Experts !

    Is it possible to change the background of the header in a QTableView too with CSS.
    For the QTableView it works well. And also the background color of the
    QHeaderView (not selected) can be set. But I can't figure out, how the header
    background can be changed, if one/more items in the Table are selected.

    thanks for your help,
    Bernd

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QHeaderView: background of selected header item with CSS

    You probably have to dynamically set the style sheet upon detecting changes in the view's selection model.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2009
    Posts
    11
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QHeaderView: background of selected header item with CSS

    You are right. The problem seems to be the version 4.3.3 which doesn't support a lot of features for table and tree view. Doing this dynamically seems to be the only chance.
    Can't await the migration to 4.5 :-)

    Thanks,
    Bernd

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QHeaderView: background of selected header item with CSS

    I don't think 4.5 will change anything in your situation.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2009
    Posts
    11
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QHeaderView: background of selected header item with CSS

    That wouldn't be a desaster. I've just tried the possibilities of CSS in Qt.
    I think that :item :indicator is not part of Qt 4.3.3 , but Qt4.5.
    I'm not sure if this solves the problem.

    best regards,
    Bernd

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QHeaderView: background of selected header item with CSS

    But you're not using ::item, you want to modify the header which is not an item.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. The following user says thank you to wysota for this useful post:

    antarctic (8th June 2009)

Similar Threads

  1. How to edit Horizontal Header Item in QTableWidget
    By ioannis in forum Qt Programming
    Replies: 6
    Last Post: 5th March 2013, 18:50
  2. QTableWidget NW corner header item?
    By McKee in forum Qt Programming
    Replies: 9
    Last Post: 30th May 2012, 23:44
  3. How to get parent of selected item in TreeView?
    By RavenS in forum Qt Programming
    Replies: 2
    Last Post: 7th March 2009, 13:27
  4. Changing selected item color in non-current window.
    By Doug Broadwell in forum Qt Programming
    Replies: 1
    Last Post: 26th August 2007, 07:09
  5. QTreeView: selection behavior upon selected item removal
    By Pieter from Belgium in forum Qt Programming
    Replies: 6
    Last Post: 11th July 2007, 16:00

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.