Results 1 to 5 of 5

Thread: DragEnter in GraphicsView

  1. #1
    Join Date
    Mar 2009
    Location
    Nashville Tn.
    Posts
    53
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default DragEnter in GraphicsView

    Qt Code:
    1. GraphicsScene *scene =new GraphicsScene(this);
    2.  
    3. scene->setBackgroundBrush(Qt::red);
    4.  
    5. myView *gView = new myView(this);
    6. gView->setGeometry(230,20,330,400);
    7.  
    8. //gView->installEventFilter(this);
    9.  
    10. gView->setScene(scene);
    11. gView->setSceneRect(0,0,100,100);
    12.  
    13. gView->setAcceptDrops(true);
    To copy to clipboard, switch view to plain text mode 

    i am only able to drop in the right most 1/4 of the view ,i have try'd using QGraphicsview insted of myView , same result. the dragenter will not fire until the right most 1/4 is entered. i am sure i am missing something quite obvious but have read everything i could find pls can somebody point me in right direction.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DragEnter in GraphicsView

    Your scene occupies only part of the view - the drops can only occur on the scene, so you get the event not when you enter the viewport but when you enter the rect occupied by the scene.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2009
    Location
    Nashville Tn.
    Posts
    53
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: DragEnter in GraphicsView

    Thanks, I thought that was the case , so i colored the scene red , when i setscene(scene), the whole view is red, there are no scroll-bars so i know the scene is smaller than the viewport and the entire view is red, the dropenter is on the myview because i read that this would go through to the scene, am i right in thinking if the scene was not centered, only part of the view would be red and by setting the dragenter/drop etc.. on the myview, wouldn't the event fire when the myview is entered regardless of setting a scene or not? ( i forgot to mention, the myview reacts the same when a scene is not set, only the right 1/4 of the myview fires the dragenter event)
    Last edited by rogerholmes; 25th July 2009 at 16:38.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: DragEnter in GraphicsView

    Quote Originally Posted by rogerholmes View Post
    Thanks, I thought that was the case , so i colored the scene red , when i setscene(scene), the whole view is red,
    Do something else. Add a rectangle item occupying the whole scene.

    am i right in thinking if the scene was not centered, only part of the view would be red
    No, that's wrong. See the idea above.

    and by setting the dragenter/drop etc.. on the myview, wouldn't the event fire when the myview is entered regardless of setting a scene or not?
    It fires on the graphicsview's viewport and is immediately intercepted by the event filter the view applies on its viewport.

    ( i forgot to mention, the myview reacts the same when a scene is not set, only the right 1/4 of the myview fires the dragenter event)
    That I do not know, maybe that's the way it works if a scene is not set on the view.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    rogerholmes (26th July 2009)

  6. #5
    Join Date
    Mar 2009
    Location
    Nashville Tn.
    Posts
    53
    Thanks
    14
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: DragEnter in GraphicsView

    thank you Wysota, i will try what you suggest.

Similar Threads

  1. Graphicsview??
    By Screeze in forum Newbie
    Replies: 2
    Last Post: 5th July 2009, 17:01
  2. Adding events to GraphicsView
    By mkarakaplan in forum Qt Programming
    Replies: 6
    Last Post: 4th May 2009, 00:26
  3. Newbie: Circuits and GraphicsView
    By RY in forum Newbie
    Replies: 10
    Last Post: 1st October 2008, 05:12
  4. Zoom GraphicsView but not Items
    By abbapatris in forum Qt Programming
    Replies: 2
    Last Post: 15th October 2007, 19:47
  5. QT GraphicsView Help
    By mistertoony in forum Qt Programming
    Replies: 15
    Last Post: 15th February 2007, 04:17

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.