Forum > QT

Performance of Qt5 LCL TListBox

(1/1)

c600g:
I've noticed that the performance difference when loading 5,000+ items into a Qt5 TListBox (lbOwnerDrawFixed) is significantly slower than a Gtk2 TListBox.

In C++ Qt5 development, I encountered a similar problem which was resolved by using the setUniformItemSizes(true) method of a QListWidget.

Does the Qt5 LCL widget set implement this method if the item sizes are uniform?

c600g:
Did a bit of diving into the C bindings a QtWidgets units to see if I could work around the issue, and it seems as if I have found a work around for the performance issue.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---uses  LCLIntf  , LCLType  {$ifdef LCLQT5}  , QtWidgets  {$endif}  ... procedure MakeQtListViewFast( lst : TListBox );{$ifdef LCLQT5}var  QtListView : TQtListView;{$endif}begin  {$ifdef LCLQT5}  QtListView := TQtListView( lst.Handle );  QtListView.setUniformItemSizes( true );  {$endif}end; 
Alan

JuhaManninen:

--- Quote from: c600g on August 05, 2021, 09:27:33 pm ---Does the Qt5 LCL widget set implement this method if the item sizes are uniform?

--- End quote ---
It is called in TQtWSCustomComboBox.CreateHandle() and in TQtWSCustomComboBox.SetItemHeight().
You can study and debug the code and create patch to improve it.
I have no idea why setUniformItemSizes() is needed or what happens if you enable it always.

c600g:

--- Quote from: JuhaManninen on August 06, 2021, 08:07:25 am ---It is called in TQtWSCustomComboBox.CreateHandle() and in TQtWSCustomComboBox.SetItemHeight().
You can study and debug the code and create patch to improve it.
I have no idea why setUniformItemSizes() is needed or what happens if you enable it always.

--- End quote ---

Thanks for the tip. It looks as if I would need to modify TQtWSCustomListBox in lcl/interfaces/qt5/qtwsstdctrls.pp to do something similar for TListBox.

JuhaManninen:

--- Quote from: c600g on August 06, 2021, 04:22:27 pm ---It looks as if I would need to modify TQtWSCustomListBox in lcl/interfaces/qt5/qtwsstdctrls.pp to do something similar for TListBox.

--- End quote ---
Sorry, my answer was a bit sloppy. I just searched the sources for setUniformItemSizes.
The qt56.pas binding library has the function mapped only for ListView:
 QListView_setUniformItemSizes
It is used by TQtListWidget.
TQtWSCustomComboBox uses a TQtListWidget for its dropdown list.
TQtWSCustomListBox also uses a TQtListWidget. You should be able to improve it without any new function mappings. Yes.

Navigation

[0] Message Index

Go to full version