Results 1 to 6 of 6

Thread: QGraphicsView widget, QGraphicsScene. Default 0.0.

  1. #1
    Join Date
    Dec 2015
    Posts
    12
    Qt products
    PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsView widget, QGraphicsScene. Default 0.0.

    Hi!
    By default point 0.0 at top left corner. How to make the lower left corner as 0.0?

    1.png2.png
    Last edited by kloopa; 3rd January 2016 at 08:45.

  2. #2
    Join Date
    Jun 2015
    Location
    India
    Posts
    185
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView widget, QGraphicsScene. Default 0.0.

    You can use QGraphicsScene::setSceneRect(QRectF),. It will set logical coordinates you want.

    Ex : if your scene geomerty is 0,0, width , height
    I think what you can do is :
    Qt Code:
    1. scene->setSceneRect(0, heigh, width, -height);
    To copy to clipboard, switch view to plain text mode 
    Last edited by prasad_N; 4th January 2016 at 06:40.
    Thanks :-)

  3. #3
    Join Date
    Dec 2015
    Posts
    12
    Qt products
    PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView widget, QGraphicsScene. Default 0.0.

    Thank you for reply.
    I tried, not working.

    self.ui.graphicsView.scene = QtWidgets.QGraphicsScene()
    self.ui.graphicsView.setScene(self.ui.graphicsView .scene)
    self.ui.graphicsView.scene.setSceneRect(0, 650, 500, -650)
    self.ui.graphicsView.setRenderHints(QPainter.Antia liasing)
    path = QPainterPath()
    path.moveTo(20.0, 20.0)
    path.lineTo(50, 20)
    path.moveTo(20.0, 20.0)
    path.lineTo(20, 50)
    self.ui.graphicsView.scene.addPath(path)
    5.png

  4. #4
    Join Date
    Dec 2015
    Posts
    12
    Qt products
    PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView widget, QGraphicsScene. Default 0.0.

    No more ways to do this?

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView widget, QGraphicsScene. Default 0.0.

    You could try a transformation.

    Translate to the bottom left point and scale with 1/-1

    Cheers,
    _

  6. #6
    Join Date
    Dec 2015
    Posts
    12
    Qt products
    PyQt3 PyQt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView widget, QGraphicsScene. Default 0.0.

    Do you have example how to do this?

Similar Threads

  1. QGraphicsscene and QGraphicsview
    By ReasyEasyPeasy in forum Qt Programming
    Replies: 3
    Last Post: 6th October 2015, 16:58
  2. Changing Default QRubberBand in QGraphicsView
    By MSUdom5 in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2013, 20:37
  3. QGraphicsView and QGraphicsScene
    By alisami in forum Qt Programming
    Replies: 8
    Last Post: 4th December 2008, 11:10
  4. QGraphicsScene and QGraphicsView
    By sabeesh in forum Qt Programming
    Replies: 7
    Last Post: 1st August 2007, 07:59
  5. QGraphicsScene and QGraphicsView
    By rossd in forum Qt Programming
    Replies: 2
    Last Post: 25th April 2007, 15:43

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