Results 1 to 3 of 3

Thread: QTableWidget select row after focus is lost?

  1. #1
    Join Date
    Aug 2009
    Location
    Brisbane, Australia
    Posts
    75
    Thanks
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableWidget select row after focus is lost?

    Hi,

    I have an issue with QTableWidget: if an item is edited, then focus is lost, the table doesn't update the item until another item is selected or the row is selected. Only one column is modifiable.

    So if I change an item then click on a seperate write button the old value is written.

    Is there an easy way to fix this or do I need to reimplement the QTableWidget class?

    Ideally it would selectRow() once focus is lost.

    I have started making my own CustomTableWidget class. Unfortunately there are a lot of differences to the standard settings, also mine currently appears on its own window

    Thanks in advance
    Brendan

  2. #2
    Join Date
    Mar 2011
    Posts
    82
    Thanks
    13
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableWidget select row after focus is lost?

    I am dealing with this very same problem right now.

    Basically the "slot_rowSelected()" event is getting called, even tho the TableWidget is not highlighted (the getSelectedRows() property, however, STILL has the value of the previously selected row).

    I generated a workaround by setting a boolean value that is true whenever it comes from the proper method, and false everywhere else, but this is an awful fix and SHOULD NOT be used.

    Anybody has any input on the subject?

    Qt 4.3.6

  3. #3
    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: QTableWidget select row after focus is lost?

    Post a small, compilable example that demonstrates the problem.

Similar Threads

  1. QMainWindow how to know when focus lost?
    By arkaha in forum Newbie
    Replies: 1
    Last Post: 12th February 2010, 06:26
  2. Focus lost
    By franco.amato in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2010, 22:07
  3. How detective lost focus application ?
    By Torsten in forum Qt Programming
    Replies: 2
    Last Post: 6th August 2008, 14:19
  4. QLineEdit lost focus
    By codebehind in forum Newbie
    Replies: 5
    Last Post: 4th May 2007, 16:02
  5. Replies: 3
    Last Post: 8th September 2006, 18:54

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.