Results 1 to 7 of 7

Thread: QGraphics scene position

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2009
    Location
    Rio de Janeiro - Brazil
    Posts
    19
    Thanks
    4
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default QGraphics scene position

    Hi people,

    I'd like to set the scene itens atleast 10 points from the top and left GraphicsView border.
    But I couldn't until now.

    Selection_022.png

    A piece of my PyQt code:
    Qt Code:
    1. (...)
    2. picture = "ui/snap/" + gamepicture
    3. if not os.path.isfile(picture):
    4. picture = "ui/pixmaps/nopic.png"
    5. if gamestatus:
    6. color = QtGui.QColor(0, 0, 0, 0)
    7. pix = QtGui.QPixmap(QtCore.QSize(238, 174))
    8. pix.fill(color)
    9. rect = QtCore.QRectF(0.0, 0.0, 238, 174)
    10. painter = QtGui.QPainter()
    11. painter.begin(pix)
    12. painter.setRenderHints(QtGui.QPainter.Antialiasing, True)
    13. path = QtGui.QPainterPath()
    14. path.addRoundedRect(rect, 10.0, 10.0)
    15. painter.drawPath(path)
    16. brush = QtGui.QBrush()
    17. brush.setTexture(QtGui.QPixmap(picture))
    18. painter.fillPath(path, brush)
    19. painter.end()
    20. pixItem = GameItem(gameid, pix, None, self.scene)
    21. pixItem.setPos((260 * col), lin)
    22. col += 1
    23. if col >= 6:
    24. lin += 220
    25. col = 0
    26. self.graphicsView.setScene(self.scene)
    27. self.graphicsView.setAlignment(QtCore.Qt.AlignLeft)
    28. (...)
    To copy to clipboard, switch view to plain text mode 

    Some tip?

    BR,

    Junix
    Last edited by junix; 13th April 2012 at 22:15. Reason: text organization

Similar Threads

  1. Saving QGraphics Scene items
    By chaltier in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2012, 06:35
  2. Infinite (circular) QGraphics Scene
    By maitai in forum Qt Programming
    Replies: 10
    Last Post: 27th March 2011, 15:23
  3. QGraphics View Scene performance with polylines
    By iampowerslave in forum Qt Programming
    Replies: 0
    Last Post: 15th November 2010, 17:03
  4. MouseEvent in QGraphics Scene?
    By fanatos in forum Newbie
    Replies: 1
    Last Post: 9th September 2010, 17:39
  5. Cursor Position in scene
    By rogerholmes in forum Newbie
    Replies: 2
    Last Post: 12th March 2010, 15:31

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.