Results 1 to 2 of 2

Thread: how to clear selection in the qtableview

  1. #1
    Join Date
    Jun 2010
    Posts
    21
    Qt products
    Qt4
    Platforms
    Windows

    Default how to clear selection in the qtableview

    hello i am new in using qtableview and i just wanted to know how do you clear the selection using QStandardItemModel

    i used the following functions
    Qt Code:
    1. main_tableview->setSelectionBehavior(QAbstractItemView::SelectRows);
    2. main_tableview->setSelectionMode(QAbstractItemView::SingleSelection);
    To copy to clipboard, switch view to plain text mode 
    main_tableview is the qtableview object

    now when i click any one of the item it selects the entire row(as i have set the properties above)

    now how do i deselect or clear the selection???
    i looked into the documentation but could not find any functions.
    Thanks for the help!

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: how to clear selection in the qtableview

    QAbstractItemView::clearSelection() ? You really should learn how to use the assistant...

Similar Threads

  1. How do I clear the rubber band after a selection is done
    By aarelovich in forum Qt Programming
    Replies: 1
    Last Post: 15th July 2010, 12:29
  2. Replies: 2
    Last Post: 26th November 2009, 04:45
  3. Clear contents of a QTableView cell before repainting
    By aspidites in forum Qt Programming
    Replies: 2
    Last Post: 21st April 2009, 16:07
  4. QTableView Row Selection
    By ToddAtWSU in forum Qt Programming
    Replies: 8
    Last Post: 12th December 2007, 21:27
  5. QTextBrowser Clear selection
    By sreedhar in forum Newbie
    Replies: 2
    Last Post: 4th April 2006, 08:23

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.