Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    DrawText() taking high cpu usage.

    General and Desktop
    3
    7
    2824
    Loading More Posts
    • 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
      sushma last edited by

      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 Reply Quote 0
      • G
        gmaro last edited by

        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 Reply Quote 0
        • S
          sushma last edited by

          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 Reply Quote 0
          • G
            gmaro last edited by

            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 Reply Quote 0
            • S
              sushma last edited by

              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 Reply Quote 0
              • G
                gmaro last edited by

                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 Reply Quote 0
                • G
                  goetz last edited by

                  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 Reply Quote 0
                  • First post
                    Last post