Forum
Sign Up
× DataGrid for Qt.C++

Focused row changed after model refresh

1 month 3 weeks ago #1 by JUAN CARLOS FONT
Hello,

We are currently using QtitanDataGrid v. 8.0, and we are experiencing the following issue: If the user focuses a row in the grid, and then refreshes the underlying model, for example doing select on an QSqlQueryModel, then the grid changes the focused row to the first row. On the old version we used, v. 5.9, this did not happen, the grid correctly maintained the focus on the currently focused row after the refresh. Is there any way we can achieve this behavior with version 8.0? It causes a lot of work for us because we now need to save the old focused row before the refresh, in order to manually re-focus it after the refresh.

Thank you in advance.

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #2 by JUAN CARLOS FONT
Any update on this? Even if returning to the old way of focusing is just not possible it would be nice to know it, so we can do the workarounds we need to do, currently we are waiting for a possible fix. Thanks.

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #3 by Developer Machines
There was a bug in the old version and we fixed it. The thing is that when the model is refreshed, the grid considers this model be a completely new and therefore the focused row is positioned at the very beginning. Since there is no guarantee that the new focused row refers to the same data as it was before the model was refreshed.
The following user(s) said Thank You: JUAN CARLOS FONT

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #4 by JUAN CARLOS FONT
Related to the same subject: after a model refresh, is there also no way of maintaining the filter the user has applied on the dataset? Could you give an example snippet of how we could at least save the filter and re-apply it after we do the refresh?
Thank you

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #5 by Developer Machines
The filter, sorting and grouping should not be reset on model refreshing. Could you describe the problem in more detail? Do you have a simple example to reproduce the problem?

Please Log in or Create an account to join the conversation.

More
1 month 3 weeks ago #6 by JUAN CARLOS FONT
Hi, it seems to me the filter is not really removed internally, but the filter panel disappears and the filter is no longer applied. I have made a workaround that checks if there is a filter applied before the model refresh, and if so, after the refresh it calls showFilterPanel() which makes the panel re-appear and the filter to be re-applied. I have attached a minimum.cpp file that shows the situation. I have not attached the other project files as I think only the .cpp is relevant to see the issue. There is a button that refreshes the model, and there I have described the problem and my current workaround.
Thanks
Attachments:

Please Log in or Create an account to join the conversation.

More
  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Moderators: Developer Machines
Time to create page: 0.144 seconds

Developer Newsletter

Join our Developer Machines newsletter to get informed on all the latest releases of the commercial components for Qt.C++, Delphi FireMonkey, updates and general knowledges.

Quick Support

Should you need any additional information about our products or licensing, please contact us at the following email addresses:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

  • This email address is being protected from spambots. You need JavaScript enabled to view it.

Get in Touch

If you would like to purchase our products or services, but don’t know how to do it the right way, please feel free to contact us:

  • This email address is being protected from spambots. You need JavaScript enabled to view it.( any questions related to our products or services )
  • This email address is being protected from spambots. You need JavaScript enabled to view it.( questions related to licensing )