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. What is signficance of mapToScene and mapRect and QMatrix
Forum Updated to NodeBB v4.3 + New Features

What is signficance of mapToScene and mapRect and QMatrix

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 914 Views 3 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.
  • Q Offline
    Q Offline
    Qt Enthusiast
    wrote on last edited by
    #1

    void createCoreBox(QRect rect)
    {

    QMatrix matrix
    QRect p = matrix.inverted().mapRect(mapToScene(rect).boundingRect().toRect());

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

      @Qt-Enthusiast
      Hi
      The
      http://doc.qt.io/qt-5/graphicsview.html
      section Item Coordinates
      explain what mapToScene does and why

      Its used to get the global coordinates of the rect for the transformation ( matrix)

      1 Reply Last reply
      0
      • Q Offline
        Q Offline
        Qt Enthusiast
        wrote on last edited by
        #3

        Yes I went through the same , but did the significance of the same

        m.sueM 1 Reply Last reply
        0
        • Q Qt Enthusiast

          Yes I went through the same , but did the significance of the same

          m.sueM Offline
          m.sueM Offline
          m.sue
          wrote on last edited by
          #4

          Hi @Qt-Enthusiast

          Do you mean: Why would I need these transformations?

          The view may contain just a small sub-area inside the whole area of where all your objects lie (which is the scene). So you need some transformation (mapping) between the small sub-area to the whole area (-> mapToScene).

          Technically there are (will be) functions that you call with view coordinates and others that you call with scene coordinates. You may even write some yourself. Then the mapping functions come in handy.

          -Michael.

          1 Reply Last reply
          1

          • Login

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