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. DrawText() taking high cpu usage.

DrawText() taking high cpu usage.

Scheduled Pinned Locked Moved General and Desktop
7 Posts 3 Posters 3.2k 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.
  • S Offline
    S Offline
    sushma
    wrote on last edited by
    #1

    hello everyone!!
    DrawText() is taking lot of CPU usage.what else to use instead of this. or is there any other way to improve DrawText().

    1 Reply Last reply
    0
    • G Offline
      G Offline
      gmaro
      wrote on last edited by
      #2

      Hi,

      With this information there is no way in the world that someone can help you.

      What drawText function, which platform, where you painting, which paint device etc.

      On the embedded platform this is typically caused by no-hardware support for painting so the CPU must rendrer every pixel by himself.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sushma
        wrote on last edited by
        #3

        Mr. Gmaro,
        i'm using Qt with GCF on Fedora 13.
        i've one scene from which i've 7 views in which i'm rendering text with drawText().
        it is fine until i'm using one view with enabled text rendering but with 6 extra views and text rendering enabled application performance get degraded and CPU usage reach to 100%. so what should i use for text rendering.
        i'm painting on QGraphicsItem.
        i'm using drawText() like this:-
        painter->drawText(Xpos+(labelPos[trackId].x())/zoomfactor,Ypos+((labelPos[trackId].y()))/zoomfactor,label2);

        Thank you!

        1 Reply Last reply
        0
        • G Offline
          G Offline
          gmaro
          wrote on last edited by
          #4

          Hi,

          Not sure if I understand you corretlty:

          • one QGraphicsScene
          • 7 QGraphicsViews?

          You're drawing something on each QGraphicsView, not on QGraphicsScene or you're creating your Subclassed QGraphicsItem with the paint() function reimplemented and you're adding it to the scene?

          You're drawing something on each view? In which way? Maybe drawing on one causes calls to redraw the rest of them? So instead of 7 draws, you have 49? Or even quite-unlimited amount of them when this is wrongly set up.

          When this Hi-load cpu occurs? On adding item to the scene or when i.e. you're moving some item with a mouse?

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sushma
            wrote on last edited by
            #5

            yes gmaro you got it correctly.
            I am using one QGraphicsScene and seven QGraphicsViews.
            i am creating my subclassed QGraphicsItem with paint() function reimplemented and adding it to scene.
            actually only one view is main, and all other 6 views are copy of this view.It is my requirement, that ever item and operation that is in main view has to be in all other six views.
            high CPU load is occurring after i'm showing all other 6 views.

            Thank you!

            1 Reply Last reply
            0
            • G Offline
              G Offline
              gmaro
              wrote on last edited by
              #6

              Please put something like
              @
              qDebug() << PRETTY__FUNCTION;
              @
              or any string you like inside the reimplemented paint() function to check how many this function is called in case of one view and how many in case of 7 views.

              That would give a good hint.

              1 Reply Last reply
              0
              • G Offline
                G Offline
                goetz
                wrote on last edited by
                #7

                Moved to the General Forum, this is Qt related and no C++ issue.

                http://www.catb.org/~esr/faqs/smart-questions.html

                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