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. QLabel.setText() Vs. QPainter.drawText()

QLabel.setText() Vs. QPainter.drawText()

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 690 Views 1 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.
  • M Offline
    M Offline
    moriailan
    wrote on last edited by
    #1

    hi-

    I would like to draw dynamic labels on GL Widget (every frame the text is changing).
    is there a difference between QLabel.setText() and QPainter.drawText()?
    what's more efficient?
    note that:

    • the setting of these labels is done through paintGL() override function
    • if i'll use QLabel- i can initialize labels on Init() func (called only once), so maybe its more efficient using QLabel??

    thanks!

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      if you check QLables paintevent here
      https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qlabel.cpp.html
      You can see its pretty huge.
      so my guess would be qpainter drawText is faster, solely due to much less instruction pr frame to process.

      M 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        if you check QLables paintevent here
        https://code.woboq.org/qt5/qtbase/src/widgets/widgets/qlabel.cpp.html
        You can see its pretty huge.
        so my guess would be qpainter drawText is faster, solely due to much less instruction pr frame to process.

        M Offline
        M Offline
        moriailan
        wrote on last edited by
        #3

        @mrjj I understand, tnx!

        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