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. Qt6 VideoOutput mapRectToSource

Qt6 VideoOutput mapRectToSource

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 221 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.
  • bunjee207B Offline
    bunjee207B Offline
    bunjee207
    wrote on last edited by
    #1

    The Qt5 VideoOutput implementation has a convenient mapRectToSource function provided by the QML API.

    With the Qt6 version it seems to be gone, is it accessible somewhere else ?

    1 Reply Last reply
    1
    • bunjee207B Offline
      bunjee207B Offline
      bunjee207
      wrote on last edited by
      #2

      Here is a simple solution without the rotation support:

      /* Q_INVOKABLE static */ QPoint WFilterBarcode::mapPointToSource(const QRect  & source,
                                                                       const QRect  & content,
                                                                       const QPoint & point)
      {
          qreal x = (qreal) (point.x() - content.left()) / content.width ();
          qreal y = (qreal) (point.y() - content.top ()) / content.height();
      
          return QPoint(x * source.width(), y * source.height());
      }
      
      /* Q_INVOKABLE static */ QRect WFilterBarcode::mapRectToSource(const QRect & source,
                                                                     const QRect & content,
                                                                     const QRect & target)
      {
          return QRect(mapPointToSource(source, content, target.topLeft    ()),
                       mapPointToSource(source, content, target.bottomRight()));
      }
      
      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