Results 1 to 7 of 7

Thread: How can I tell if user leaves a row in a tableview

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default How can I tell if user leaves a row in a tableview

    Can some please show me how to code the event to determine if the user has clicked off of a row in a tableView ?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How can I tell if user leaves a row in a tableview

    You can do this by implementing the mouse click event.
    Maybe you might need to install an event filter for the scroll area, but I'm not sure here.

  3. #3
    Join Date
    May 2009
    Location
    Canada
    Posts
    163
    Thanks
    7
    Thanked 20 Times in 20 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows Android

    Default Re: How can I tell if user leaves a row in a tableview

    Quote Originally Posted by rdjenner View Post
    Can some please show me how to code the event to determine if the user has clicked off of a row in a tableView ?
    Are you asking about the case where the user has simply clicked elsewhere, or the case of, for example, shift-clicking on the currently selected row...or both?

  4. #4
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I tell if user leaves a row in a tableview

    I would need for both. What I am trying to accomplish is to save the record once the users exits the row, either update or insert if new.

  5. #5
    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: How can I tell if user leaves a row in a tableview

    Are the QAbstractItemView::currentChanged() and/or QAbstractItemView::selectionChanged() signals what you are looking for?
    Last edited by ChrisW67; 23rd August 2010 at 02:04. Reason: Self imposed grammar nazi

  6. #6
    Join Date
    Aug 2010
    Posts
    28
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How can I tell if user leaves a row in a tableview

    Whichever one tells me that the row is about to change and allow me to save the current row data before actually leaving the row.

  7. #7
    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: How can I tell if user leaves a row in a tableview

    Have you read the docs for those two signals and thought about how you can use them? Seems that currentChanged() is what you want.

Similar Threads

  1. Debugging in MSVS leaves zombie console window
    By T4ng10r in forum Qt Programming
    Replies: 3
    Last Post: 11th March 2010, 09:59
  2. Replies: 2
    Last Post: 27th November 2008, 10:16
  3. QGraphicsItem leaves junk on screen
    By Gopala Krishna in forum Qt Programming
    Replies: 18
    Last Post: 12th December 2007, 06:23
  4. help in tableview
    By bala in forum Qt Programming
    Replies: 3
    Last Post: 12th November 2007, 15:46
  5. Replies: 1
    Last Post: 22nd January 2007, 12:13

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
  •  
Qt is a trademark of The Qt Company.