Results 1 to 5 of 5

Thread: mouseePress / mouseEvent , cursor coordinates & zoom issue

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2016
    Posts
    13
    Qt products
    Platforms
    Windows

    Question mouseePress / mouseEvent , cursor coordinates & zoom issue

    Hi ,

    i'm a beginner in PyQt and i want to know please : what's the difference between mousePressEvent() and mouseReleaseEvent() ?

    also i've another issue : i showed an image on a QgraphicsView like this : QImage ( path ) ==> convert to QPixmap ==> set On the QGraphicsView's Scene



    is it possible to have the cursor coordinates Inside the image without clicking on any mouse or keybord button ? just navigating Inside the image and showing image pixel coordinates on the status bar ?


    i'd like also to code a zoom function usine wheelEvent or comboBox :

    i used the QImage instance and apply scale(current.width * zoom_factor, current.height() * zoom_factor) function , the problem i want the zoom to be centered around the current position of the cursor.

    using , my method i have to use scroll bars each time i zoom to see the region i wanted to see ... and that's not cool

    Thanks for reading ,

  2. #2
    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: mouseePress / mouseEvent , cursor coordinates & zoom issue

    Quote Originally Posted by Qtdigitex View Post
    i'm a beginner in PyQt and i want to know please : what's the difference between mousePressEvent() and mouseReleaseEvent() ?
    As their names say, one is called when a mouse button is pressed, the other one when a mouse button is released.

    Quote Originally Posted by Qtdigitex View Post
    is it possible to have the cursor coordinates Inside the image without clicking on any mouse or keybord button ? just navigating Inside the image and showing image pixel coordinates on the status bar ?
    You probably need to enable mouse tracking on the view and then implement mouseMoveEvent()


    Quote Originally Posted by Qtdigitex View Post
    i'd like also to code a zoom function usine wheelEvent or comboBox :

    i used the QImage instance and apply scale(current.width * zoom_factor, current.height() * zoom_factor) function , the problem i want the zoom to be centered around the current position of the cursor.

    using , my method i have to use scroll bars each time i zoom to see the region i wanted to see ... and that's not cool
    Do you want to zoom or do you want to scale the elements?
    For zooming you can just call scale() on the view and set the transformation anchor to view center.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 15th June 2021, 16:00
  2. Qgraphicsview zoom issue
    By tarunrajsingh in forum Qt Programming
    Replies: 6
    Last Post: 23rd April 2013, 11:28
  3. Replies: 1
    Last Post: 10th April 2013, 09:08
  4. focus out event and cursor issue
    By sajis997 in forum Qt Programming
    Replies: 1
    Last Post: 27th February 2012, 02:55
  5. QGraphcisView issue with mouse cursor image
    By dpatel in forum Qt Programming
    Replies: 0
    Last Post: 20th July 2010, 07: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
  •  
Qt is a trademark of The Qt Company.