Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. FontMetrics in QWindow?
Qt 6.12 LTS is out! See what's new in the release blog

FontMetrics in QWindow?

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.4k 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.
  • S Offline
    S Offline
    samy03
    wrote on last edited by
    #1

    Hi guys,

    How can I get fontMetrics of a font in my QWindow that I am using for OpenGL?

    I was using a command like this in QWidget:
    fontMetrics().width(text());

    But this command does not work in QWindow. I even tried creating a widget inside a QWindow but I still was not able to use the command shown above.
    Is there a way I can use the same command on QWindow? Or maybe another way to get similar results in QWindow?

    Thank you,

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

      Hi,

      What are you trying to achieve with that QWindow ?

      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
      0
      • S Offline
        S Offline
        samy03
        wrote on last edited by
        #3

        I am running a program for text scrolling in beaglebone. I need Opengl to get beaglebone's GPU working, hence had to use QWindow.

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

          You can also use the Graphics View framework with a QOpenGLWidget as backend.

          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
          0
          • S Offline
            S Offline
            samy03
            wrote on last edited by
            #5

            How can I do that? Is there any example I can look at?

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

              It's described in the QGraphicsView details using QGLWidget, but it's the ancestor of QOpenGLWidget.

              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
              0

              • Login

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