Results 1 to 5 of 5

Thread: Issue with custom delegate in tableview

  1. #1
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Issue with custom delegate in tableview

    Hi,
    I have issue with Highlighting cell of tableView with my own delegate (checkbox), i used this code :

    Qt Code:
    1. if(option.state & QStyle::State_Selected)
    2. {
    3. painter->fillRect(option.rect,option.palette.highlight());
    4. }
    To copy to clipboard, switch view to plain text mode 
    this works but the problem is that when the focus of table is changed the color of selected row have to be gray but in my table the color of my delegate cells will stay dark blue(state_selected).
    How to fix that?
    thanks

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Issue with custom delegate in tableview

    At a guess, paint it differently when the state is not QStyle::State_Active or Style::State_HasFocus or QStyle::State_Enabled

  3. The following user says thank you to ChrisW67 for this useful post:

    alizadeh91 (10th April 2013)

  4. #3
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Issue with custom delegate in tableview

    thanks, I think so but with which palette i should paint it? (which palette is inactive cells in table view. I've seek it in QPalette but nothing found!)

  5. #4
    Join Date
    Jan 2012
    Location
    Iran, Tehran
    Posts
    308
    Thanks
    75
    Thanked 24 Times in 21 Posts
    Qt products
    Qt4 Qt5 PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: Issue with custom delegate in tableview

    Anyone knows how to deal with it?! Whats the palette of unfocused cells?

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

    Default Re: Issue with custom delegate in tableview

    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.


Similar Threads

  1. Button Delegate Problem in TableView
    By alizadeh91 in forum Qt Programming
    Replies: 3
    Last Post: 17th March 2013, 17:13
  2. Replies: 4
    Last Post: 22nd September 2010, 22:34
  3. Custom Model? Custom View? Custom Delegate?
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 11th February 2010, 20:23
  4. Replies: 0
    Last Post: 1st February 2010, 11:00
  5. TableView Delegate questions
    By No-Nonsense in forum Qt Programming
    Replies: 3
    Last Post: 11th December 2006, 09:39

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.