Are Qt Widgets really native controls (on Windows)?



  • I suspect they are all custom paint/message handled and not real HWND. Most obvious with the QComboBox which behaves differently (keyboard navigation after you selected an entry) and the QTableView which is magnitudes slower than the ListView32 from native Win32.



  • No,
    Generally, QWidget doesn't take use of system "native" controls provided by user32.dll . For example, QTableView is totally painted by Qt itself, it doesn't depend on ListView32.

    And from Qt4.4 on, Non-toplevel-QWidget even doesn't have a HWND handle unless you try to access the handle.



  • That explains why it is so slow (especially listview/tableview)



  • In what way is it slow? Maybe you are using these views the wrong way?



  • Slow as in scrolling through a couple of 100 items. It just feels sluggish. Not like the native Win32 listview. No styles are used whatsoever.



  • Scrolling (like crazy) through a QTableView with about 2000 items and a (badly) customized QStyledItemDelegate I got one core of my CPU work at about 75% of its maximum capacity (3.4GHz). That's certainly not good, but since the CPU seems to handle it, shouldn't there be no visible delays/stutters/whatever you mean by sluggishness?

    I am not trying to "defend" Qt here, but I would be highly interested in some precise numbers. Qt is quite a huge library, and it certainly has some overhead, so "minor" performance decreases should be expected. But since you say you're able to see a significant difference, I am very curious now. What program is using a native tableview, so I can have a comparison?



  • Well an easy example would be to take folder with some 2000 files, open it in Windows Explorer and scroll the listview (in detail or icon view) there. Its fast.
    Then use the QFileSystemModel to fill a QTableView with the same folders data and scroll it. Slow.



  • Ok, I gave it an "uneducated" try. It feels about the same to me, but: Whereas Qt ate about 75% of a single core, the explorer used up about 1.5 full cores (twice as much). I didn't even know that it could make use of several cpu cores, but this - in addition to its more native implementation - could explain a lot regarding differing speeds.

    I am pretty sure you can tune the scrolling behavior of a QTableView, too. So maybe it's just a matter of them being set up differently?



  • Thats because Windows Explorer uses Hardware Acceleration through Direct2D to paint the surfaces. But I also think that the internal data model is way more efficient than what Qt does with its modelIndex. Need to profile it though.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.