Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Is this a bug on the Model-View (QTableView-QSqlQueryModel)?
Forum Updated to NodeBB v4.3 + New Features

Is this a bug on the Model-View (QTableView-QSqlQueryModel)?

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 876 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Code_ReaQtor
    wrote on last edited by
    #1

    Last time on one of my projects I encountered an odd problem.

    I used QTableView and QSqlQueryModel. At first when it is created, "currentIndex" will be NULL (not point to any indexes/items) since no part of the view is selected. When a row or item is selected, currentIndex changes and will have a value.

    BUT, when I click on the vacant part of the view (usually at the bottom or at right since the table is not stretched and there are few entries), currentIndex still points to the "last" index which I supposedly be CLEARED. What I did, is to do a small "hack by subclassing" on the QTableView to emit a signal when the blank area is clicked then did other stuff to clear the currentIndex

    So the question is, Is it actually normal for the view to still have a value on the currentIndex even items are unselected? It should be "lastIndex" (though it is not present in QTableView) and not "currentIndex" to have the value.

    Is it normal or a bug?

    Please visit my open-source projects at https://github.com/Code-ReaQtor.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved