Results 1 to 2 of 2

Thread: QGraphicsView: Dialog Position Doubt

  1. #1
    Join Date
    Jul 2007
    Posts
    39
    Thanks
    10

    Default QGraphicsView: Dialog Position Doubt

    Hi

    I have a QGraphicsView with many QGraphicsItem. When I double click on an item, there is a property dialog that pops out. It works fine except that the position of the dialog is away from the item. I would like to have the dialog just below the item being clicked.

    I tried setting the position of the dialog using move(). When I used the view as the parent of the dialog and set the position based on the item's corresponding view position, the dialog is fine when the view is maximized but when the view is reduced to a smaller size I get the dialog outside the view.

    I would like to have the dialog pop-up just below the item irrespective of the view size.

    can anyone help me with some suggestions?

    Thanks
    Arjun

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView: Dialog Position Doubt

    When you receive the double click event, use the QGraphicsSceneMouseEvent::screenPos() and move the dialog relative to that point.

    It is not ok to use view coordinates, since they are local to the view and very volatile.

    Regards

  3. The following user says thank you to marcel for this useful post:

    arjunasd (6th August 2007)

Similar Threads

  1. Initial Dialog Position
    By nleverin in forum Newbie
    Replies: 1
    Last Post: 15th July 2007, 10:19
  2. Dialog positioning in GNOME
    By simk in forum Qt Programming
    Replies: 2
    Last Post: 16th March 2006, 09:41
  3. dialog box
    By Bahar in forum Qt Programming
    Replies: 3
    Last Post: 31st January 2006, 14:52

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.