Results 1 to 9 of 9

Thread: QTableView Row Selection

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableView Row Selection

    I cannot upgrade to 4.3.3 right now due to requirements. I was lucky to get to move from 4.1.4 to 4.3.0. I am pushing to get approval to upgrade to 4.3.3, but I don't have it yet. It doesn't make sense to me why it worked great in 4.1.4 but not now in 4.3.0. Why would something break that was working.

    I don't manaully set the selection. I just told it to select the entire row when a cell was clicked on. I do emit a signal on the mouseRelease event so the parent holding the QTableView can do further calculations when a row is selected, but nothing that influences the table. The table is not being modified in anyway when a selection occurs. To me the confusing part is the first row I select updates correctly, highlighting the whole row, but subsequent rows do not.

    I doubt I have added any substance to my first post besides stating why I am not at 4.3.3 yet, but I am sorry I am not with 4.3.3 but when higher beings set the requirements, it is hard to get them to allow changes sometimes. So until then this is what I am stuck with. Thanks again for your help!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableView Row Selection

    Could you post a minimal compilable example reproducing the problem? We'll try to run it on newer versions of Qt to see whether the problem was resolved.

  3. #3
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableView Row Selection

    I can try to come up with one but it could take a bit as I have a QVariantDataModel that stores my data. And then I call the setModel on this to store the data. However, this appears to be working fine since it has no influence on the QTableView selection at all.

    But in the meantime, can you explain why calling repaint( ) or update( ) on the table or dialog doesn't work, but bringing a secondary window to the front over the window with the table, forcing the table to redraw, causes the rows to be highlighted correctly? Thanks!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTableView Row Selection

    QVariantDataModel? Does it differ from QStandardItemModel?

  5. #5
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTableView Row Selection

    Well I figured out my problem. I originally had the table displaying 6 columns of data and had the selection set to NoSelection. After I would hit a load button, I would add 2 more columns of data to the table and then allow MultiSelection once the data was loaded. I would reset the table headers to add on these last 2 columns headers and this was where my problem came in at. I did not have the "beginInsertColumns" and "endInsertColumns" calls being made around setting the titles and adding the columns. So my selection thought I was trying to select 8 columns and the table only had 6 columns. Once I fixed the problem to make sure all 8 columns were showing, the selection fixed itself because there were a proper number of columns. Thanks for your help and I guess the "beginInsert" calls are more strict in Qt 4.3.0 than in Qt 4.1.4. Thanks again though!

Similar Threads

  1. [SOLVED] QTreeView drawing selection with icons
    By Timewarp in forum Qt Programming
    Replies: 7
    Last Post: 7th February 2013, 07:52
  2. QTableView selection problem
    By aiprober in forum Qt Programming
    Replies: 12
    Last Post: 9th June 2008, 11:55
  3. QTableView row selection
    By davemar in forum Qt Programming
    Replies: 2
    Last Post: 5th December 2007, 14:39
  4. Model sorting vs. selection
    By VlJE in forum Qt Programming
    Replies: 2
    Last Post: 25th October 2006, 16:46
  5. CheckBox and selection in QTableView
    By Mike Krus in forum Qt Programming
    Replies: 1
    Last Post: 21st September 2006, 20:31

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.