Results 1 to 16 of 16

Thread: A Bug in Qt?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2008
    Location
    Nanjing, China
    Posts
    66
    Thanks
    12
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default A Bug in Qt?

    I use a QTableView and a model subclassed QAbstractTableModel to display the items which is increasing per second. And in order to display the items number which is selected by user, I use QItemSelectionModel.The attachment complete the task.But there is a strange bug.
    The selction setting of tableview is
    Qt Code:
    1. ui.tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    2. ui.tableView->setSelectionMode(QAbstractItemView::MultiSelection);
    To copy to clipboard, switch view to plain text mode 
    And the critical codes which bring bug are
    Qt Code:
    1. QHeaderView* VerHeaderView = ui.tableView->horizontalHeader();
    2. VerHeaderView->swapSections(1,2); //this is critial for the behavior of m_selectionModel
    To copy to clipboard, switch view to plain text mode 
    If I selected items in the tableview by push down left button of mouse,draw diagonal line of a rectangel,the release the button. The displayed number of selected items is totally wrong.

    If deleted the critical codes, repeat the selection in the same way. This time, the displayed number is right. I want to know, where is the mistake?
    Attached Files Attached Files
    Jerry

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.