Table Scroll Modes

Discussion about recent product features & solutions!
Search

Post Reply
8 posts • Page 1 of 1
emaddocks
Posts: 73
Joined: Tue Sep 04, 2018 12:50 am

Table Scroll Modes

Post by emaddocks »

Hi,

Just wanting to know if it is possible to configure a table to be "ScrollPerItem" or "ScrollPerPixel"? As per what is available in the extended properties of the Tree View widget.

The table only seems to provide "ScrollBarAsNeeded", "ScrollBarAlwaysOff" and "ScrollBarAlwaysOn". The table looks to be implemented as "ScrollPerPixel" as rows can be half seen when scrolling.

The issue we have with this is that when a table is dynamically updated the updateLines function updates/inserts lines and seems to ensure the top visible row is not half visible. This causes the table to jump if you have scrolled to a 'half' row position when the updateLines function is run.

It seems as though qt does support this "ScrollPerItem" style scrolling in the native qt table widget. Would it be possible to add this feature to the next patch / version of OA? (see https://doc.qt.io/qt-5/qtablewidget.html#scrollToItem)

We are using OA v3.17 P014 on RHEL 8.2.


Cheers
Eric

gschijndel
Posts: 330
Joined: Tue Jan 15, 2019 3:12 pm

Re: Table Scroll Modes

Post by gschijndel »

I guess you could do this by setting the 'lineVisible' property.

emaddocks
Posts: 73
Joined: Tue Sep 04, 2018 12:50 am

Re: Table Scroll Modes

Post by emaddocks »

Yeah tried that on the scroll event but that just makes it jumpy every time you scroll the table not just when a new entry is added. It also makes the last row difficult/impossible to see if your table is say 10.1 rows in height. If this is the case then as the last row is shown the visible 10% of the top row forces the whole row to show and pushes the bottom row out of view.

gschijndel
Posts: 330
Joined: Tue Jan 15, 2019 3:12 pm

Re: Table Scroll Modes

Post by gschijndel »

In some project I did do something like first jumping to the last/first row before making the actual wanted row visible, so it would be completely visible. But it is not a pretty solution.

You could set the Qt property with a stylesheet (or by setting the stylesheet property of the table), like this:

Code: Select all

QTableView { qproperty-verticalScrollMode: "ScrollPerItem"; }

emaddocks
Posts: 73
Joined: Tue Sep 04, 2018 12:50 am

Re: Table Scroll Modes

Post by emaddocks »

Thanks gschijndel! That's exactly what I was after. I always find it difficult to know how to add these Qt properties to the stylesheet. Do you know of a good web resource that defines what properties are available? The Qt website has them but nowhere can I find that the actual syntax needed to be 'QTableView { qproperty-verticalScrollMode: "ScrollPerItem"; }'.

gschijndel
Posts: 330
Joined: Tue Jan 15, 2019 3:12 pm

Re: Table Scroll Modes

Post by gschijndel »

The Qt properties can be set in a stylesheet with the syntax:

Code: Select all

qtproperty-<property name>: "<property value>";
The name and value of the property can be found in the Qt documentation

The documentation is missing this information. I only found this wonderful feature out because of the (trend) examples in the documentation.

emaddocks
Posts: 73
Joined: Tue Sep 04, 2018 12:50 am

Re: Table Scroll Modes

Post by emaddocks »

Thanks for that gschijndel

Unfortunately going back to the 'qproperty-verticalScrollMode: "ScrollPerItem";' fix, this works from a scrolling point of view but now when adding to the table this property seems to ignore/override the '.lineVisible(iRow)' function when trying to retain the previously visible row. With the "ScrollPerItem" property the table shifts to the bottom when you run the '.updateLines()' function

User avatar
leoknipp
Posts: 2846
Joined: Tue Aug 24, 2010 7:28 pm

Re: Table Scroll Modes

Post by leoknipp »

I did not test it. Maybe you can solve the issue by using the option "lineVisible" again after calling updateLines().
E.g. in the aes.ctl library in funktion aes_workCB lineVisible is called in the end of the function to show a specific line.

Best Regards
Leopold Knipp
Senior Support Specialist

Post Reply
8 posts • Page 1 of 1