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. DrawTextItemDevice::metric: Invalid metric command on OS X
Forum Updated to NodeBB v4.3 + New Features

DrawTextItemDevice::metric: Invalid metric command on OS X

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 2.8k 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.
  • P Offline
    P Offline
    pi31415926
    wrote on last edited by
    #1

    Hello,

    I get a lot of messages "DrawTextItemDevice::metric: Invalid metric command" when outputting static text.
    I'm simply doing it like this (the painter was created in a QWidget with "QPainter painter(this);"):
    QStaticText text(string);
    painter.drawStaticText(pos.x, pos.y, text);

    The call stack is the following:
    (anonymous namespace)::DrawTextItemDevice::metric(QPaintDevice::PaintDeviceMetric) const
    QPainterPrivate::effectiveDevicePixelRatio() const
    QPainterPrivate::hidpiScaleTransform() const
    QPainterPrivate::updateMatrix()
    QPainter::setWorldTransform(QTransform const&, bool)
    QPainter::setTransform(QTransform const&, bool)
    QStaticTextPrivate::init()
    QPainter::drawStaticText(QPointF const&, QStaticText const&)
    QPainter::drawStaticText(int, int, QStaticText const&)
    HexEditorCoreQT::drawText(_DOUBLE_POINT&, UNICODE_BUFFER*)

    To me it seems that I can't fix this myself since in QPainterPrivate::effectiveDevicePixelRatio() there is a Mac-specific call to device->metric(QPaintDevice::PdmDevicePixelRatio)

    Does anybody have any suggestions? Thanks for any help!

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

      Hi and welcome to devnet,

      What combination of OS X/Qt are you using ?

      Did you check the "bug report system":http://bugreports.qt-project.org to see it if was something known ?

      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
      • P Offline
        P Offline
        pi31415926
        wrote on last edited by
        #3

        I'm using OS X 10.8.5 and Qt 5.2.0

        Not only the Qt bug report system but also Google doesn't return this as a known issue.

        Btw: outputting a string with painter.drawText(x, y, string) outputs no message.

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

          Can you provide a minimal compilable example that shows the behavior ?

          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
          • P Offline
            P Offline
            pi31415926
            wrote on last edited by
            #5

            Fortunately the issue is reproducible with a very simple example:
            https://dl.dropboxusercontent.com/u/46505886/StaticTextError.zip

            The (unwanted) warning message output is located at line 570 of https://qt.gitorious.org/qt/qt/source/cf179ef3e38516555ce60517aa8e085b33e75744:src/gui/text/qstatictext.cpp

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

              Confirmed, can you open a bug report "here":http://bugreports.qt-project.org with your example ?

              Don't forget to post the link here

              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
              • P Offline
                P Offline
                pi31415926
                wrote on last edited by
                #7

                The issue can be tracked on on https://bugreports.qt-project.org/browse/QTBUG-36419

                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