Results 1 to 2 of 2

Thread: how to use the void QAbstractItemView::clearSelection()

  1. #1
    Join Date
    Nov 2013
    Posts
    6
    Thanks
    2

    Default how to use the void QAbstractItemView::clearSelection()

    I want to have a button which when it is clicked it clear the selection for QListWidget items
    I searched and people were suggesting to use
    Qt Code:
    1. void QAbstractItemView::clearSelection()
    To copy to clipboard, switch view to plain text mode 
    any suggestion on how to use this ?
    Qt Code:
    1. void MainWindow::on_Button_clear_all_clicked()
    2. {
    3. //
    4. }
    To copy to clipboard, switch view to plain text mode 

  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: how to use the void QAbstractItemView::clearSelection()

    Quote Originally Posted by tomorrow View Post
    any suggestion on how to use this ?
    Qt Code:
    1. void MainWindow::on_Button_clear_all_clicked()
    2. {
    3. ui->listWidget->clearSelection();
    4. }
    To copy to clipboard, switch view to plain text mode 
    QListWidget is a QAbstractItemView. You could connect the signal direct to the QListWidget slot.

    As i understand it this will delete the content of the selected cells. If you mean to unselect all the cells then you should look at the methods on the listWidget->selectionModel() object.

Similar Threads

  1. Replies: 3
    Last Post: 26th November 2009, 18:28
  2. Q_RETURN_ARG and void problem
    By SABROG in forum Qt Programming
    Replies: 0
    Last Post: 16th June 2009, 12:19
  3. error: void value not ignored as it ought to be
    By dreamer in forum Qt Programming
    Replies: 2
    Last Post: 5th May 2008, 16:17
  4. QTextOStream and void*
    By mclark in forum Newbie
    Replies: 4
    Last Post: 7th August 2006, 18:40
  5. diffrence between void and virtual void
    By raphaelf in forum General Programming
    Replies: 2
    Last Post: 23rd February 2006, 13:58

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.