Results 1 to 3 of 3

Thread: How to highlight a row in QTableWidget while the cursor hovers on the row?

  1. #1
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Question How to highlight a row in QTableWidget while the cursor hovers on the row?

    Hi all,
    How to highlight a row in QTableWidget while the cursor hovers on the row?
    My method is to respond the CellEntered signal and redraw all the widgets' background color in the table in the related slot. But the problem is after I use SetCellWidget to set a widget into a cell, and the signal cannot be catched in that cell :-( why this happen and how to fix it?
    I know this method is not good. Is there any good method?
    Thank you very much!

  2. #2
    Join Date
    Sep 2010
    Posts
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to highlight a row in QTableWidget while the cursor hovers on the row?

    Nobody knows that??

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to highlight a row in QTableWidget while the cursor hovers on the row?

    There are 2 ways..
    1) You can use delegates to draw the row background...
    You will need to set the row to highlight in the delegate and based on that, do the highlighting.

    2) Catch the signal of current row. Iterate over the items in that row and set background for each item.

Similar Threads

  1. how to set Cursor with ms excel cursor like style?
    By xiongxiongchuan in forum Qt Programming
    Replies: 2
    Last Post: 10th August 2010, 03:37
  2. QTableWidget highlight current position in header
    By lalesculiviu in forum Qt Programming
    Replies: 0
    Last Post: 27th February 2010, 20:10
  3. Replies: 2
    Last Post: 2nd October 2009, 16:32
  4. Replies: 2
    Last Post: 12th October 2008, 15:42
  5. How to synchronize text cursor and cursor in QTextEdit
    By kennyxing in forum Qt Programming
    Replies: 6
    Last Post: 18th February 2007, 10:14

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.