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. Drag and drop between different QMdiSubwindows

Drag and drop between different QMdiSubwindows

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 409 Views 1 Watching
  • 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.
  • MasterBLBM Offline
    MasterBLBM Offline
    MasterBLB
    wrote on last edited by
    #1

    Hey Qt Devs

    I need a hint how to raise an inactive QMdiSubwindow when I put mouse over it, while I have pending drag operation initiated from other subwindow. So far as I tested dragEnterEvent(), enterEvent() and so on don't work due to other window is inactive. What else I can use to detect drag went over another subwindow?

    1 Reply Last reply
    0
    • MasterBLBM Offline
      MasterBLBM Offline
      MasterBLB
      wrote on last edited by
      #2

      I managed to solve this on my own. I share the solution in case of someone will also occur such issue.
      Reimplementing dragEnterEvent() is necessary, and here is how:

      void AComplexWidgetPutIntoMdiSubwindowWhoseChildStartsDragNDrop::dragEnterEvent(QDragEnterEvent *event)
      {
          if (event->mimeData()->hasFormat(supportedMimeFormat))//supported mime is something you define
          {
              QMdiSubWindow *w = qobject_cast<QMdiSubWindow*>(parent());//this gets QMdiSubwindow for the widget
              QMdiArea *area = w->mdiArea();
      
              area->setActiveSubWindow(w);//and this causes it to be raised as top, active window
          }
          QWidget::dragEnterEvent(event);
      }
      
      1 Reply Last reply
      3

      • Login

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