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. [SOLVED] Drag and Drop problems with custom build tab widget
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Drag and Drop problems with custom build tab widget

Scheduled Pinned Locked Moved General and Desktop
6 Posts 3 Posters 3.2k 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.
  • N Offline
    N Offline
    notgary
    wrote on last edited by
    #1

    I've inherited a codebase at work that includes a custom build tab widget which consists of:

    • A TabManager derived from a QObject
    • A QTabBar as a member of the TabManager
    • TabPageWidgets derived from QWidget

    There is also a mechanism by which tabs can be undocked from the TabManager, and there used to be a mechanism that allowed them to redocked, and I've been tasked with foguring out why it no longer works.

    The TabManager also contains a TabBarEventFilter object, another custom class solely for handling events on the QTabBar. Within this class is a function called eventFilter(QObject*, QEvent*), which has a section that handles DragMove and DragEnter events. I've checked the code out and confirmed that the QTabBar is being set to accept drag events by writing the following inside the eventFilter function

    @if ( ( eventType == QEvent::DragEnter ) || ( eventType == QEvent::DragMove ) ) {
    bool isEnter = ( eventType == QEvent::DragEnter );

      QDragMoveEvent* de = static_cast<QDragMoveEvent*>(event); // Returns true
      de->setAccepted( true );
      std::cout << "de->isAccepted(): " << de->isAccepted() << std::endl; // Returns true
    
      return true;
    

    }@

    Given that the acceptance of the drag event is being confirmed, I'm at a loss to explain why the tab is still not dockable. From what I've said above, can anyone think of any reason why this should be the case?

    1 Reply Last reply
    0
    • G Offline
      G Offline
      goetz
      wrote on last edited by
      #2

      Did you implement the dropEvent()?

      http://www.catb.org/~esr/faqs/smart-questions.html

      1 Reply Last reply
      0
      • K Offline
        K Offline
        KA51O
        wrote on last edited by
        #3

        Also check if the MimeType is accepted when drop occurs.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          notgary
          wrote on last edited by
          #4

          Thanks a lot for your responses. It turns out the problem was that the MIME types weren't getting handled properly due to a couple of function stubs that had been forgotten about during a previous refactoring exercise.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            So this is solved?

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • N Offline
              N Offline
              notgary
              wrote on last edited by
              #6

              It is, and I've updated the title accordingly.

              1 Reply Last reply
              0

              • Login

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