Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wheel event on DockAreaTabBar #654

Closed
ma-robox opened this issue Jul 22, 2024 · 2 comments
Closed

Wheel event on DockAreaTabBar #654

ma-robox opened this issue Jul 22, 2024 · 2 comments

Comments

@ma-robox
Copy link

I don't receive the wheelEvent in DockAreaTabBar (using the simple example with many tabs as per issue #641 ). I think it is because with many tabs the event is sent to one of the tabs and not the tab bar.
To solve this I have to add a case for CDockAreaTabBar::eventFilter for QEvent::Wheel.

bool CDockAreaTabBar::eventFilter(QObject *watched, QEvent *event)
{
    bool Result = Super::eventFilter(watched, event);
    CDockWidgetTab* Tab = qobject_cast<CDockWidgetTab*>(watched);
    if (!Tab)
    {
        return Result;
    }
    switch (event->type())
    {
    case QEvent::Hide:
        Q_EMIT tabClosed(d->TabsLayout->indexOf(Tab));
        updateGeometry();
        break;
    case QEvent::Show:
        Q_EMIT tabOpened(d->TabsLayout->indexOf(Tab));
        updateGeometry();
        break;
    // Setting the text of a tab will cause a LayoutRequest event
    case QEvent::LayoutRequest:
         updateGeometry();
         break;

    // Manage wheel event
    case QEvent::Wheel:
        wheelEvent((QWheelEvent* )event);
        break;

    default:
        break;
    }
    return Result;
}

Another issue I have is that while dragging a tab, and also scrolling with the mouse wheel, the dragged tab is not repainted where the mouse is, but it is dropped correctly in that position in the tab bar.

bug_tab_bar_wheel.mp4
@dail8859
Copy link

I looked into this at one time in #607 but I don't know enough about Qt's event handling to propose a solution at that time. But yes I also noticed the wheel events were not getting passed to the correct control. Just my two cents :)

ma-robox added a commit to ma-robox/Qt-Advanced-Docking-System that referenced this issue Jul 23, 2024
@githubuser0xFFFF
Copy link
Owner

Fixed this in master. Scrolling the tab bar with the mouse wheel should work properly now. Scrolling the tabg bar is only bossible if no tab is currently dragged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants