Results 1 to 2 of 2

Thread: QTableView default selection

  1. #1
    Join Date
    Mar 2017
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Question QTableView default selection

    By default, how to select the first row in QTableView with QFileSystemModel? When i use table->selectRow(0) it selects nothing, when i use QObject::connect(model, &My_model::directoryLoaded, [&]{table->selectRow(0);}); it selects fourth row. But if i use table->selectRow(0) in events (void keyPressEvent(QKeyEvent *event) for example), it works ok, what is the problem?
    Last edited by nammidd; 17th June 2018 at 20:03.

  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: QTableView default selection

    Is the view sorting, perhaps through a QSortFilterProxyModel dynamic sort/filer? This can upset selection.

Similar Threads

  1. default QTableView behavior question
    By nlgootee in forum Qt Programming
    Replies: 1
    Last Post: 1st July 2016, 20:51
  2. Replies: 6
    Last Post: 25th September 2012, 23:41
  3. Replies: 6
    Last Post: 27th August 2012, 23:44
  4. Select First Row as default in QTableView ?
    By hohoanganh205 in forum Newbie
    Replies: 6
    Last Post: 22nd December 2011, 08:47
  5. Replies: 2
    Last Post: 26th November 2009, 04:45

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.