Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsView and QGraphicsScene drawing 10 000 QGraphicsSimpleTextItem is very slow
Forum Updated to NodeBB v4.3 + New Features

QGraphicsView and QGraphicsScene drawing 10 000 QGraphicsSimpleTextItem is very slow

Scheduled Pinned Locked Moved Solved General and Desktop
10 Posts 4 Posters 1.3k Views 2 Watching
  • 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.
  • Tarik EL JABIRIT Offline
    Tarik EL JABIRIT Offline
    Tarik EL JABIRI
    wrote on last edited by
    #1

    Hi,
    I am using Qt for a while, so I am drawing 10 000 QGrapicsSimpleTextItem in QGraphicsView with QGraphicsScene.
    And I implemented a zoom in and zoom out with the function scale(), I use QGraphicsView::ScrollHandDrag to drag the scene.

    The problem is when I fitInView the view becomes slow to zooming and draging.

    Note:

    • I tried caching all possiblities.
    • I am using QOpenGLWidget.
    • drawing 10 000 QGraphicsLineItem has no effect on performance instead of QGrapicsSimpleTextItem.

    Is there a way to customize the performances of drawing the text items in Qt.

    Thank you in advance.

    JonBJ Pablo J. RoginaP 2 Replies Last reply
    0
    • Tarik EL JABIRIT Tarik EL JABIRI

      Hi,
      I am using Qt for a while, so I am drawing 10 000 QGrapicsSimpleTextItem in QGraphicsView with QGraphicsScene.
      And I implemented a zoom in and zoom out with the function scale(), I use QGraphicsView::ScrollHandDrag to drag the scene.

      The problem is when I fitInView the view becomes slow to zooming and draging.

      Note:

      • I tried caching all possiblities.
      • I am using QOpenGLWidget.
      • drawing 10 000 QGraphicsLineItem has no effect on performance instead of QGrapicsSimpleTextItem.

      Is there a way to customize the performances of drawing the text items in Qt.

      Thank you in advance.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Tarik-EL-JABIRI
      Well, 10,000 items is a lot for the framework to look through to fit! Do you really need that many items, I'm not sure the user can even see them all?

      1 Reply Last reply
      1
      • Tarik EL JABIRIT Tarik EL JABIRI

        Hi,
        I am using Qt for a while, so I am drawing 10 000 QGrapicsSimpleTextItem in QGraphicsView with QGraphicsScene.
        And I implemented a zoom in and zoom out with the function scale(), I use QGraphicsView::ScrollHandDrag to drag the scene.

        The problem is when I fitInView the view becomes slow to zooming and draging.

        Note:

        • I tried caching all possiblities.
        • I am using QOpenGLWidget.
        • drawing 10 000 QGraphicsLineItem has no effect on performance instead of QGrapicsSimpleTextItem.

        Is there a way to customize the performances of drawing the text items in Qt.

        Thank you in advance.

        Pablo J. RoginaP Offline
        Pablo J. RoginaP Offline
        Pablo J. Rogina
        wrote on last edited by
        #3

        @Tarik-EL-JABIRI I guess you need to re-think the user experience, and as @JonB mentioned think about displaying all those items at once.
        As a user I cannot imagine looking at 10K items on a laptop display; maybe your use case asks for dual 50 inch monitors I don't know.
        I guess I'd approach this issue trying to use like a region of the screen, given the current zoom level, and with that constrain find and draw only the items inside the region.

        Upvote the answer(s) that helped you solve the issue
        Use "Topic Tools" button to mark your post as Solved
        Add screenshots via postimage.org
        Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

        1 Reply Last reply
        1
        • Tarik EL JABIRIT Offline
          Tarik EL JABIRIT Offline
          Tarik EL JABIRI
          wrote on last edited by
          #4

          @JonB
          Thanks for your response.
          I need them all, because my app will work with large topographic plans with a lot of Items (Texts, lines, ploylines, ....) .
          and that is not friendly with performances in Qt;

          I don't know how to customize this.

          AutoCAD is doing very well with large scenes like this.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Did you already looked at the 40000 Chips example ?

            It might contain some interesting stuff for you use case.

            Hope it helps

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • Tarik EL JABIRIT Offline
              Tarik EL JABIRIT Offline
              Tarik EL JABIRI
              wrote on last edited by Tarik EL JABIRI
              #6

              @SGaist
              Thank you for your response.
              Yes i have seen this example but is not drawing text the problem is with the text items not with lines or rectangles or polylines the problem is all about rendering text a lot of text items.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Are these all different texts ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                Tarik EL JABIRIT 1 Reply Last reply
                0
                • SGaistS SGaist

                  Are these all different texts ?

                  Tarik EL JABIRIT Offline
                  Tarik EL JABIRIT Offline
                  Tarik EL JABIRI
                  wrote on last edited by
                  #8

                  @SGaist
                  Hi,

                  Not all of them there are some of are the same and others different.

                  But Qt is ok with 10k lines but text is a problem for it.
                  I dont how Qt render text but when i remove text items it works fine and fast. But I need text in my drawing.

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    What it if you generate images out of the text (just for testing) ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    Tarik EL JABIRIT 1 Reply Last reply
                    1
                    • SGaistS SGaist

                      What it if you generate images out of the text (just for testing) ?

                      Tarik EL JABIRIT Offline
                      Tarik EL JABIRIT Offline
                      Tarik EL JABIRI
                      wrote on last edited by
                      #10

                      @SGaist
                      Hi,
                      I don't know but the text might be edited.
                      So thank you everyone.
                      I want to close this topic.

                      1 Reply Last reply
                      0

                      • Login

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