Results 1 to 2 of 2

Thread: Drag and drop - parent notification

  1. #1
    Join Date
    Mar 2007
    Posts
    74
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Drag and drop - parent notification

    Hi,

    I have created a small LED widget which I use in
    several forms. I had made theis widget draggable and had
    implemented some code dragEnterEvent(), etc in the widget class to accomplish this.

    This works and I am able to drag the LED to another LED.

    I now realize that the LED widget does not have enough information to correctly determine
    whether a certain drag and drop should be allowed. This information can only be determined
    from witihin the parent form class in which the LEDs are embedded.

    What I would like is to do is have functions within the parent form class called when drag
    operations involving the child LED widgets occur.

    How does one do this?

    Thanks!

    Mark

  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 and drop - parent notification

    Oh... this is a terrible design... In such situation I'd really implement the drag and drop in the parent and not in the led. But if you insist on going this way, you should cast parent() to the form's class using dynamic_cast or qobject_cast and if the cast returns a non-zero pointer, you can safely call the method you want.

Similar Threads

  1. Drag & drop with model/view (Qt4)
    By yogeshm02 in forum Qt Programming
    Replies: 16
    Last Post: 19th September 2011, 21:36
  2. Strange behavior with Drag and Drop (not always drops)
    By Mona Shokrof in forum Qt Programming
    Replies: 1
    Last Post: 27th May 2007, 19:00
  3. Replies: 7
    Last Post: 8th September 2006, 17:19
  4. Drag and drop revisited
    By Big Duck in forum Newbie
    Replies: 2
    Last Post: 30th June 2006, 17:41
  5. Drag 'n Drop problem
    By kiker99 in forum Qt Programming
    Replies: 4
    Last Post: 16th January 2006, 17:35

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.