QTableView becomes very slow when multiple rows are selected - performance

I have a model of about 1000 rows, with one of the columns changes every second.
I placed a cusom sort/filter model between the real model and the table view so as for the rows to be filtered immediately after they changed.
Now comes the problem:
If nothing is selected in the table view, everything just works fine; but when I have selected some rows, the table becomes lagging. The more rows selected, the more lagging it is.
Why? hope some one could give me a hint, thanks in advance!

Sorry, but there is a whole lot of potential places where performance can go down in QTableView.
The easiest way to pinpoint the slowdown is to profile the application. If you have the call(s)
that eats the cpu, it's far more simpler to deduce what is the cause and fix it.
Also you don't say much about the design of the custom sort/filter proxy. If you use QSortFilterProxyModel beware it does not scale well.

While painting the (top) header for a table with selection enabled, the function:
bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent) const
is called (twice for each column - but may vary on selection mode).
This function iterates through all selected rows (Line 1333 in "qitemselectionmodel.cpp" Qt 4.8.5).
So if there are many rows selected, the paint for each header column will get really slow.
Same for left header with cols/ rows switched.
The called functions are mostly not virtual - so there seems to be no way to avoid this without completely drawing your own header or hiding the header.
Maybe Qt should optimize this.

Related

How to prevent content jumping/scrolling in Angular 5 with NGRX

Let's say I have a long page with a table (or to be correct with a set of containers that contain tables) and there is a lot of data in these tables, so that it doesn't fit into a screen and therefore it is possible to scroll the page with scrollbars.
Now I have a checkbox in each row of the table so that I can select some rows and perform some actions with them.
These checkboxes are tied to the state so that when I check one of them, the state gets updated and entire page gets re-rendered. If I understand correctly, this leads to unexpected content scrolling (jumping).
So my question is: is there any common approach to avoid this unexpected behavior? I'm thinking of separating user interactions into a separate state, but it feels like a reinventing the wheel a bit. Any other ideas or standard approaches?
#Simon_Weaver, #user2216584 your comments were correct: just need to add trackBy to prevent Angular from redrawing containers

Handsontable: how to prevent the table from refreshing when a value changes

first post to StackOverflow, though I've been finding great tips for a few years here. Hope to resolve a vexing problem with handsontable.
I have an application that presents a handsontable instance with several columns whose content/format is dependent upon the value in a cell in another column. I determine the content and format of the dependent cells by way of a database query and server-side processing, the results of which are sent back to handsontable for processing in the afterChange function.
My problem is that whenever the user updates one cell in the table, ALL cells blink while the code laboriously reconsiders the formatting for ALL cells in the table. The preferred behavior would be to ONLY update the cells for which the formatting has changed, i.e., that small set which is dependent on the value that changed in the first cell. It's only these dependent cells whose contents are being changed anyway. Why redraw the WHOLE table??
I have searched and search here and elsewhere, and the closest to an answer I could find is that this is the intended behavior for the table. I don't agree...when the table is anything larger than 10 rows, the updating process is painfully slow and distracting to the user.
Any suggestions? I'm open to directly editing the handsontable js code, but would prefer to flip some flag I'm unaware of if possible.
Thanks all!
afterChange fire only one time for the cell you just updated (documentation example).
Your problem might come from an afterChange "chain reaction". The first afterChange modifies one or more related cells, triggering others afterChange and so on. If that's the problem, you can put a filter on the source parameter.
Another solution could be to work on a copy of the data to do your updates (see data binding), and once everything is fine, inject it back on the table with loadData, and ignore the loadData source in the afterChange callback.
Finally, if you still have some performance issues, you can check the performance tips, and remove any option that might slow your table (example with columnSorting)
(sorry I can't use comments to identify precisely from where your issue come...)

IAccessible deisgn questions: child objects, thread safety, and header rows/comctl32.dll header controls, and a few other questions on top of that

So before I continue developing my accessible table I read this, on exposing data tables and the general MSAA documentation and I want to clear up a few things before I actually go ahead and write out this implementation, just so I can get everything just right.
For the record, this table is strictly owner-data and is row-based, where a given row can be selected, and a single cell within this row can be focused. Otherwise it behaves similarly to a listview control, but is not one, so I'm not going to try to take advantage of its accessibility features. In particular, any column can contain text, images, or checkboxes (and I might add more features); there might be background colors and text editability in the future as well. All cells in a given column have one of these types. The type will not change during runtime.
I am choosing to use MSAA because I still need Windows XP support, and I would rather not require developers and end users to have both SP3 and the .net framework together, which UI Automation seems to require (and even if the SP3 part is wrong, the "is not standalone/does not come out of the box with the OS" part still makes me uneasy about implementing that).
Is it process-safe/thread-safe to call my internal control functions within the accessible object method implementations, or should I use WM_USER messages to make sure everything happens all on one thread of one process? (In addition, would my error handling/debugging traps be run in the client or in the server in either case?)
From what I can gather, I need to build a three-level IAccessible hierarchy: the table itself on top, followed by each row, followed by each cell in the row. However, the various IAccessible methods that take a child object only take a VT_I4 VARIANT to specify the child. Does this mean I'm going to have to create an IAccessible for each row as well, or for each cell as well, or something else? Should I have a standard accessible object for each of these? Can they share? And what about NotifyWinEvent(); how would I indicate that a given cell has changed? Or should I say the whole row has changed...?
If the answer to question 2 is "yes", I'm going to wind up with a lot of IAccessible objects that need to be notified when the table control is destroyed. If the answer to question 1 is "it is not thread-safe", then is it safe to hold a lock in my IAccessible methods whenever I access my table control and have that hold the lock when it's time to invalidate all those IAccessibles? Or should I investigate some other approach? I see talk on MSDN of "proxy objects" but I'm not really following how that would help... especially if I need to make lots of IAccessibles.
From what I can gather I need to return (number of rows) + 1 rows in my table's get_accChildCount() method, with the first row being full of column header cells. But I'm not using a custom header control; I'm using the standard comctl32.dll header control. Should I hide that control and construct my column headers according to the Exposing Data Tables document or should I relegate the first row to the header control? I don't see a way to do both... (I do not have row headers, so will not be implementing that.) Columns can be user-resized, but may be automatically sized to fit until the user first does so (maybe).
Is it safe to relegate IDispatch methods to the window handle's standard accessible object? Even in the case of the row and cell IAccessibles? Or will the standard accessible object's IDispatch not call my IAccessible methods?
What should accDoDefaultAction() do for a checkbox cell, toggle the checkbox state? And for an editable text cell, should it enter editing mode?
Thanks. (Hoping none of this sounds dumb...)
UPDATE 6 January 2015
I changed the wording of some of the paragraphs above and have one more question:
How do I correctly check for errors from LresultFromObject(), by casting to an HRESULT and checking that, or by comparing a signed version of the LRESULT value and seeing if it's less than zero, or something else?

Coordinating highlighting between two tables

The challenge is this: 2 coordinated tables, 1 with an overview that is laid out on a grid, the other contains detailed information about the cells in the first table. (This overview is used for other information as well, which has been removed from the minimal example below.) Mousing over either one will highlight both. Clicking on the overview table will hide or show the rows of the data view.
The problem is that the data is being defined by a JSON data object and the order of that object is very important. It's important that the data is mapped to the overview without reordering either. There may be cells not represented in the data view that are in the overview and nothing bad should happen.
http://fiddle.jshell.net/g8z5h/14/
The problem is using select all lets d3 define the order things will be taken. I need to coordinate the mapping myself. I'm hoping there's an elegant solution to this that doesn't involve writing separate mouseover and mouse click functions.
You can use a key function to tie the selection to your data:
http://bost.ocks.org/mike/selection/#key
http://bost.ocks.org/mike/constancy/#key-functions

WP7 pivot headers stop animating when I scoll too fast

i have a pivot control with around 20 items that are data binded to an observable collection. One of these items has a long text inside, and I think it delays a bit to data bind. when i scroll too fast and pass this item, the headers start to behave strange, the highlighted header disappears from the screen and i see the other headers. the animation of headers stops.
How can i fix this? any ideas? You can reproduce this problem on a device.
thanx
I would have though that having 20 pivot items was more likely to be the cause of the problem, rather than a long pivot title. However, from a user experience point-of-view I would suggest that 20 pivot items is not going to provide a good user experience especially as all pivot items are loaded on when the pivot is started, so performance is likely to be poor, too.
I would suggest that you consider an alternative approach. Perhaps you could use the Panorama to provide a Hub-like experience with your data grouped into different Panorama items. You could then use a Pivot on secondary pages to show group contents where appropriate.
I can't say that I've experienced this, but then I haven't found a need to use a Pivot with 20 pages.
Could it be that if you're finding the need to flick that quikly through the pages that another UX would be more appropriate?
Perhaps a listbox to present a choice of items allowing ultra smooth and fast scrolling, from which the user can choose to select an item and drill down for details.
The databound project template provides some out of the box handling to demonstrate the concept, but don't be show to roll your own in a vanilla project template.
I've experienced the same issue with a pivot control with only 4 pivot items. The animation gets screwed up when the pivot item containing a long list is selected, so I'm guessing that because pivots don't load their data until the item is selected, that the pivot control is getting screwed up trying to load the long list while animating...so it gives up on the animation.
I haven't really figured out what to do about this yet. One solution is to not bind the data in the pivot item until that item is selected. This isn't really ideal, but it would likely solve the animation issue.

Resources