Results 1 to 4 of 4

Thread: Cannot find the necessary pseudo state

  1. #1
    Join Date
    Sep 2014
    Posts
    18
    Thanks
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Question Cannot find the necessary pseudo state

    Hello,
    I try to style my QTableWidget through StyleSheet
    I have already use:
    QTableView::item to set padding
    QTableView::item:enabled to set background only for enabled cells
    QTableView::item:focus to set background if cell is clicked

    If I clicked the cell it get background from QTableView::item:focus, and if the cell loses focus it get background from QTableView::item:enabled. Only two states.
    But in QTableWidget default style (if not use setStyleSheet) there is 3 states:
    1.default background for all cells
    2.selected background (when some cell selected)
    3. AND if the QTableWidget loses focus, the last selected cell is still highlighted with grey color... -> So if the widget loses focus (or some child widget show on top) you still see in QTableWidget which cell was selected last
    The Question is:
    Which pseudo state can set Background for the cell that was selected last if QTableWidget loses focus?

  2. #2
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Cannot find the necessary pseudo state

    Have you tried the selection-color and selection-background-color properties?

    Edit: Or perhaps the :selected pseudo-state?
    Last edited by jefftee; 28th May 2015 at 03:37.

  3. #3
    Join Date
    Sep 2014
    Posts
    18
    Thanks
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: Cannot find the necessary pseudo state

    Thanks
    I use Qt 4.8.1
    I don't know what to say...
    With QTableView::item -> states :selected, selection-background-color doesn't have any effect at all

  4. #4
    Join Date
    Sep 2014
    Posts
    18
    Thanks
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: Cannot find the necessary pseudo state

    any of this lines works with my Project on Windows perfectly:
    QTableWidget::item:selected
    QTableWidet {selection-background-color... selection-color}

    the same lines on linux doesn't works at all... same code... Whyyyyyyyyyyy?
    Qt libs identical = 4.8.1
    ------------------------------
    I have no choice but to use QTableWidget::item:focus at least it's works some how

Similar Threads

  1. pseudo modal dialog via a widget!
    By rockdemon in forum Qt Programming
    Replies: 6
    Last Post: 25th July 2013, 15:29
  2. Change state property within a current state?
    By prophet0 in forum Qt Quick
    Replies: 1
    Last Post: 30th May 2012, 19:23
  3. Problem with QHeaderView pseudo-states and stylesheets
    By marwyn in forum Qt Programming
    Replies: 3
    Last Post: 7th July 2011, 17:33
  4. State Machine returning to previous state
    By akiross in forum Qt Programming
    Replies: 2
    Last Post: 10th May 2011, 00:39
  5. Replies: 0
    Last Post: 19th December 2010, 16:03

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.