Results 1 to 5 of 5

Thread: drag/dropping outside app

  1. #1
    Join Date
    Nov 2007
    Posts
    11

    Default drag/dropping outside app

    hello,

    i have a custom widget i am trying to implement drag/drop on. what i want to happen is when the user drags my custom widget outside of the application i want to create a new window for that widget.

    i am having some difficultly though as i understand how to accept drag/drop operations inside the widget (been using this for awhile within other custom widgets).

    i tried overloading dragleaveevent however i didnt get the outcome id expect.

    has anyone tried this before? and possibly point me in the correct direction?

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

    Default Re: drag/dropping outside app

    Quote Originally Posted by musikit View Post
    i have a custom widget i am trying to implement drag/drop on. what i want to happen is when the user drags my custom widget outside of the application i want to create a new window for that widget.
    From what I understand, what you are trying to do is very hard to achieve. The reason is that the drop is handled not by the application where the drag originates but by the application where the object is dropped - in your case the desktop. There probably is some platform dependent API that is able to perform what you want, but currently Qt won't handle such cases just by itself. You could register a quasi application handling some mime-type in your system and then this application could do "something" to spawn that window, but in my opinion this is a very complex task.

  3. #3
    Join Date
    Nov 2007
    Posts
    11

    Default Re: drag/dropping outside app

    ok... well while building other portions of my custom widget's drag/drop i did notice that if i drag/drop it over the desktop i get an "IgnoreAction"

    could i just overload the "IgnoreAction" to do what i want? or is that not recommended?

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

    Default Re: drag/dropping outside app

    Overload where? As I said, your application will not be called when a drop on the desktop occurs. You won't know where the object was dropped on and if it was dropped at all (ignore action can occur both when a drag has been canceled or when the drop occured on an invalid target).

  5. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: drag/dropping outside app

    I am not sure... but may be you can try this...

    Find the id of desktop.
    In drag action, check the target. If it equals the desktop, then launch a widget as u desire.

    Hope it helps.

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.