Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. I did a test QWidget 5% CPU Max and QML up to 50%

I did a test QWidget 5% CPU Max and QML up to 50%

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
12 Posts 4 Posters 3.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    archqt
    wrote on last edited by
    #1

    Hi,
    i just did a simple model in C++ with QAbstractTableModel with 4 columns (string in them). I did the code which use role and column to make it works either with TableView in QML and QTableView in QWidgets.
    It works, but....if i see the CPU usage when i move into the screen (either with scrollbars or with keys) the QWidgets only use 5% CPU max (and often less) but the QML program use up to 50% CPU.
    I can send the code but there is not delegate on them so quite simple. I thought that because QML used the GPU with OpenGL it would be quicker but it is not the case.
    Is there any reason ? Thanks
    Sincerely

    A 1 Reply Last reply
    0
    • A archqt

      Hi,
      i just did a simple model in C++ with QAbstractTableModel with 4 columns (string in them). I did the code which use role and column to make it works either with TableView in QML and QTableView in QWidgets.
      It works, but....if i see the CPU usage when i move into the screen (either with scrollbars or with keys) the QWidgets only use 5% CPU max (and often less) but the QML program use up to 50% CPU.
      I can send the code but there is not delegate on them so quite simple. I thought that because QML used the GPU with OpenGL it would be quicker but it is not the case.
      Is there any reason ? Thanks
      Sincerely

      A Offline
      A Offline
      archqt
      wrote on last edited by
      #2

      @archqt For the value there are hight because of Kde5 (plasma). On lxqt i have 5% for QML and less than 1% (max 1%) for QWidgets. So it is a bit better but QML is far slower.
      I don't have any javascript on it so why is there a so big difference from QML to QWidgets ?

      1 Reply Last reply
      0
      • jpnurmiJ Offline
        jpnurmiJ Offline
        jpnurmi
        wrote on last edited by
        #3

        TableView from Qt Quick Controls 1.x is unfortunately a very bad example. Please do not use it for measuring the performance of Qt Quick or QML. A ListView with a delegate that contains multiple columns is a million times faster.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          archqt
          wrote on last edited by
          #4

          Hi,
          ok i will look at it.
          Thanks

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AlaNan
            wrote on last edited by
            #5

            Is the TableView from QtQuick Controls 2 better?

            jpnurmiJ 1 Reply Last reply
            0
            • A AlaNan

              Is the TableView from QtQuick Controls 2 better?

              jpnurmiJ Offline
              jpnurmiJ Offline
              jpnurmi
              wrote on last edited by
              #6

              @AlaNan said:

              Is the TableView from QtQuick Controls 2 better?

              There is no TableView in Qt Quick Controls 2. We surely would like to offer a fast TableView in the future, but it’s not a small task to rewrite that beast so that it performs well. ;) We’ll probably take quite different approach, something much closer to ListView and GridView in Qt Quick core. Any progress on this can be monitored via QTBUG-51710.

              V 1 Reply Last reply
              0
              • A Offline
                A Offline
                AlaNan
                wrote on last edited by
                #7

                Thank you very much for the information. I sure hope you will come up with something soon. I strongly rely on table views in my applications. Seems that the decision to switch to QML was premature ... I expected it to be further developed than it currently is, but that's probably my fault :-/

                jpnurmiJ 1 Reply Last reply
                0
                • A AlaNan

                  Thank you very much for the information. I sure hope you will come up with something soon. I strongly rely on table views in my applications. Seems that the decision to switch to QML was premature ... I expected it to be further developed than it currently is, but that's probably my fault :-/

                  jpnurmiJ Offline
                  jpnurmiJ Offline
                  jpnurmi
                  wrote on last edited by
                  #8

                  @AlaNan Which particular features of TableView do you need? Qt Quick Controls 2 provides a bunch of styled item delegate types. It is straight-forward to build a multi column view by using ListView from Qt Quick, and using a Row as delegate. It's a whole different story if you're after draggable or resizable columns, or other classic desktop behavior, of course.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    AlaNan
                    wrote on last edited by
                    #9

                    @jpnurmi That's interesting, didn't think of that.
                    Sadly it's exactly the classical desktop behavior I'm after. I'm currently struggling with resizing columns on doubleclicking on the column delimiters as I described here.
                    I had the (probably naive) idea that QML/Qt Quick would give me the classical desktop environment like QWidget did and additionally give me the opprtunity to move to mobile devices easily if desired. Moreover I really like the declarative approach to create the GUI part of an application. Now switching back to QWidget seems too costly so I have to get along with what QML currently provides. Please note that I'm not blaming anyone but myself for this situation which I'm in due to my misjudgement of what QML/QT Quick does provide at the moment. I really appreciate what the Qt developers have achieved so far and I'm positive that QML will become a great framework also for desktop development eventually!

                    1 Reply Last reply
                    0
                    • jpnurmiJ jpnurmi

                      @AlaNan said:

                      Is the TableView from QtQuick Controls 2 better?

                      There is no TableView in Qt Quick Controls 2. We surely would like to offer a fast TableView in the future, but it’s not a small task to rewrite that beast so that it performs well. ;) We’ll probably take quite different approach, something much closer to ListView and GridView in Qt Quick core. Any progress on this can be monitored via QTBUG-51710.

                      V Offline
                      V Offline
                      vladstelmahovsky
                      wrote on last edited by
                      #10

                      @jpnurmi btw, is there any plans to continue work on this? I have an application with several TableView' s handling thousands of row and its so slow, that I even started to do my own simplified TableView implementation w/o those huge amount of costly bindings. But may be I just doing work which someone already did

                      V jpnurmiJ 2 Replies Last reply
                      0
                      • V vladstelmahovsky

                        @jpnurmi btw, is there any plans to continue work on this? I have an application with several TableView' s handling thousands of row and its so slow, that I even started to do my own simplified TableView implementation w/o those huge amount of costly bindings. But may be I just doing work which someone already did

                        V Offline
                        V Offline
                        vladstelmahovsky
                        wrote on last edited by
                        #11

                        @vladstelmahovsky made a prototype in QML/JS. Starting to move to C++

                        1 Reply Last reply
                        0
                        • V vladstelmahovsky

                          @jpnurmi btw, is there any plans to continue work on this? I have an application with several TableView' s handling thousands of row and its so slow, that I even started to do my own simplified TableView implementation w/o those huge amount of costly bindings. But may be I just doing work which someone already did

                          jpnurmiJ Offline
                          jpnurmiJ Offline
                          jpnurmi
                          wrote on last edited by
                          #12

                          @jpnurmi btw, is there any plans to continue work on this?

                          Yes, it's on the TODO-list among many other things. :) Unfortunately we only have some rough prototypes so far. When a new TableView will be introduced, there certainly won't be any JS involved. The goal is to make it as fast as ListView and GridView, and support all the same item view transitions and so on. In other words, the implementation is likely to be based on the same internal QQuickItemView class, but just provide a table layout for the items. The cumbersome part is to try to somehow support those classic desktop use cases that are conveniently baked into the TableView type in Qt Quick Controls 1.

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved