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. Setting the coordinate axes on the scene
Forum Update on Monday, May 27th 2025

Setting the coordinate axes on the scene

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

    Good day to all!
    I really hope that knowledgeable people will have no difficulties in answering, but I'm just missing something.
    Please tell me how in Qt (5.15) to overlay your coordinate axes on top of the "regular" ones on the QGraphicsView window? As I understand it, by default everything there is based on pixels, but this is not what I need at all.
    I ultimately want to get an area for drawing GraphicsView, the entire space of which will be occupied by a graphic scene with well-defined coordinate intervals in advance.
    In other words, I want to create a window for drawing with a Cartesian coordinate system, where X can take values, for example, from zero to 5000, and Y - from 1000 to 2000, and that mouse clicks on the graphic scene transmit exactly "these" coordinates, not pixels.
    I tried to play with QTransform, but some trolling happens there - if I just scale the view, then I get the coordinates of mouse clicks multiplied by the zoom factor (that is, rounded to tens when zooming 10 times) - great, but wrong; I think the offset of the origin from zero is also done through the transformation matrix, but that's still a long way off.
    I am very grateful in advance for the help and I really hope for it!
    P.S. In the very end, I expect to get a scalable UI window, the coordinates inside the graphic scene on which will not change, that is, regardless of the size and aspect ratio of the GraphicsView window, we should always see coordinates within [Xmin, Xmax, Ymin, Ymax] (as, for example, in MatLab).
    P.P.S. I apologize for my English :)

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Loc888
      wrote on last edited by Loc888
      #2

      I am not really the most knowlegable person, but it seems like it would be much easier to make a very big scene rect, and then just divide let's say by 1000, this way you would get something which could emulate what you want. So i would rather setup a conversion, 1pixel = 1000 of whatever you want.

      So for example a mouse click at x = 500, and y = 1200, would return to you x = 0.5, and y = 1.2, other then that i used QGraphicsScenes a lot, and there's nothing like you want.

      You could also setup just a conversion from whatever you want, to pixels, and from pixels to whatever you want.

      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