Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Drop event on tab widget



  • Hi Team

    I am working on a -QT- Qt component for tab widget and could add new tabs using it. What I want:

    I create 1 tab widget via dragging my tab plugin on main-window in Qt creator.

    I drag one more instance of tab plugin over on tab created in above step. I can do it.

    I have overridden eventfilter in my tab plugin as shown below and tried overriding Drop event with no success.

    @
    bool QTab::eventFilter(QObject *obj, QEvent ev)
    {
    QWidget
    widget=new QWidget;
    widget->setAcceptDrops(true);

    if(((ev->type() == QEvent::DragEnter) || (ev->type() == QEvent::Drop) || (ev->type() == QEvent::DragMove) )
    {
    //some action on drop event
    }

    return false;
    

    }
    @

    Please let me know how to check if drop event occur on tab widget?

    Thanks.
    aswal

    Edit: fixed message layout. Please at least use @ tags around code sections; Andre



  • Why are you creating a new QWidget in your eventFilter? Note that this gets called a lot. So, you are just creating loads of widget objects, and then leaking them.


Log in to reply