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. drawing dense items in graphics scene
Qt 6.11 is out! See what's new in the release blog

drawing dense items in graphics scene

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 700 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #1

    i have a lot of coordinates like these: (-0.45, -3.1), (-0.14, -1.8) etc. and i need to draw polygons using these.
    as you can see the values are so close to each other that when i draw the items now, they overlap, and look very small in the center of the view.
    how can i draw so that all drawn items occupy all visible area of the view? should i do something like multiplying the values of coordinates? or what?

    thanks.

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

      Hi,

      Frome QGraphicsView's documentation:

      QGraphicsView can be used to visualize a whole scene, or only parts of it. The visualized area is by default detected
      automatically when the view is displayed for the first time (by calling QGraphicsScene::itemsBoundingRect()). To
      set the visualized area rectangle yourself, you can call setSceneRect(). This will adjust the scroll bars' ranges 
      appropriately. Note that although the scene supports a virtually unlimited size, the range of the scroll bars will 
      never exceed the range of an integer (INT_MIN, INT_MAX).
      

      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
      • U user4592357

        i have a lot of coordinates like these: (-0.45, -3.1), (-0.14, -1.8) etc. and i need to draw polygons using these.
        as you can see the values are so close to each other that when i draw the items now, they overlap, and look very small in the center of the view.
        how can i draw so that all drawn items occupy all visible area of the view? should i do something like multiplying the values of coordinates? or what?

        thanks.

        S Offline
        S Offline
        samdol
        wrote on last edited by samdol
        #3

        @user4592357
        Why don't you put your QGraphicsScene to QGraphicsView by
        void QGraphicsView::setScene(QGraphicsScene *scene)
        and use
        void QGraphicsView::scale(qreal sx, qreal sy) ?
        You may also use mousewheel to zoom in/out.
        See this

        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