Results 1 to 14 of 14

Thread: Item size not updating after scaling QGraphicsView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Oct 2015
    Posts
    17
    Thanks
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Post Item size not updating after scaling QGraphicsView

    i want to show some images vertically using QGraphicsView and QLabel in pyqt.

    i am using scale method for scaling QGraphicsView. the problem is that when i scale (zoom in) QGraphicsView size of labels not updating and because of that when i scale QGraphicsView and setting label's pixmap again resulting image quality is poor.

    here is my code:
    Qt Code:
    1. my_graphics_view = QtGui.QGraphicsView()
    2. scene = QtGui.QGraphicsScene()
    3. graphics_widget = QtGui.QGraphicsWidget()
    4. layout = QtGui.QGraphicsLinearLayout(QtCore.Qt.Vertical)
    5. default_size = QtCore.QSize(400 , 400)
    6. for number in xrange(num_pages):
    7. lbl = QtGui.QLabel()
    8. lbl.setMinimumSize(default_size)
    9. lbl.setStyleSheet("background-color : white")
    10. lbl.setContentsMargins(0, 0, 0, 0)
    11. lbl.setScaledContents(True)
    12. widget = scene.addWidget(lbl)
    13. layout.addItem(widget)
    14. graphics_widget.setLayout(layout)
    15. scene.addItem(graphics_widget)
    16. my_graphics_view.setScene(scene)
    17. my_graphics_view.show()
    To copy to clipboard, switch view to plain text mode 

    How can I get proper size for labels or make them resize automatically?
    Last edited by Santa.fat; 26th October 2015 at 07:50.

Similar Threads

  1. Replies: 0
    Last Post: 14th June 2015, 18:50
  2. Replies: 2
    Last Post: 20th February 2012, 07:30
  3. QGraphicsView not updating properly.
    By spraff in forum Qt Programming
    Replies: 0
    Last Post: 3rd July 2009, 10:36
  4. Updating QGraphicsView
    By has2k1 in forum Newbie
    Replies: 2
    Last Post: 8th April 2007, 21:02
  5. Updating Foreground for QGraphicsView
    By tts80 in forum Qt Programming
    Replies: 5
    Last Post: 4th January 2007, 15:28

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.