Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. DragLeaveEvent wont be called

DragLeaveEvent wont be called

Scheduled Pinned Locked Moved Unsolved General and Desktop
dragleaveeventdrag and dropdrag problemdrag
4 Posts 2 Posters 2.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Marcel RuppM Offline
    Marcel RuppM Offline
    Marcel Rupp
    wrote on last edited by
    #1

    Hello Guys,
    I've got go a question that's annoying me for a few days...

    I wrote a program in which you can drag&drop an element to another. The DragEnterEvent and the DragMoveEvent were called correctly but the DragLeaveEvent isn't called but as soon as I drop the "package" or leave the form with my cursor it is called instantly.

    I got no plan why this is doing this way hope you can help me with this!

    Greets Marcel

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome
      DragLeaveEvent
      This event handler is called when a drag is in progress and the mouse leaves this widget

      But if your widget is the whole form, it would only send this if you move the mouse outside
      the form.

      If you had a widget inside the form, moving outside this widget should fire it.

      1 Reply Last reply
      1
      • Marcel RuppM Offline
        Marcel RuppM Offline
        Marcel Rupp
        wrote on last edited by
        #3

        Yeah mrjj,

        Here's the code to add the widget to the screen:

        RootItem* rootItem = new RootItem();
        rightScrollArea->setWidget(rootItem);
        rightBox->addWidget(rightScrollArea);
        

        I tought this would "add" the widget, cause when I enter this widget the event is triggered correctly...

        Here you can see the form: http://files.classy-gaming.de/editor.png
        This element should be colored white as I leave it with the cursor but it doesn't.

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          HI
          so rootItem is your "drop" widget?
          Is the yellow on picture rootitem or the white one where mouse is? ( A=8 )

          It does look correct so a bit odd.

          and
          void dragEnterEvent(QDragEnterEvent* event) Q_DECL_OVERRIDE;

          should be called when u leave this small area.

          I assume you are 100% sure that is not called and its not just
          the change to while part that is failing.

          I can't guess from this little code what could be wrong.sorry.

          Just for test, could you run my editor and see it does indeed say
          "drag leave" when u drag from the list on the left to center.

          https://www.dropbox.com/s/ikra7pm161lzf56/DMDesigner.zip?dl=0

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved