Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.8.2
-
None
Description
When using the Mac trackpad to scroll horizontally through tabs in a QTabBar/QTabWidget, the close buttons of the tabs do not move with the tabs. They stay fixed instead. When changing active tabs or resizing, they snap back to the correct position.
My best guess is that the problem is in the WheelEvent of qtabbar.cpp, around line 2408, where a call to d->layoutWidgets(); should be added after the update(), analogously to what is done in line 707. But I didn't manage to build Qt on my machine so couldn't test this.
The same bug was reported in a project using Qt here: https://github.com/texstudio-org/texstudio/issues/3280
Small example app that illustrates the problem:
#include <QApplication> #include <QTabWidget> #include <QWidget> #include <QVBoxLayout> #include <QLabel> #include <QStyle> int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setStyle("Fusion"); QWidget mainWindow; mainWindow.setWindowTitle("QTabWidget Demo"); mainWindow.resize(400, 300); QVBoxLayout *layout = new QVBoxLayout(&mainWindow); QTabWidget *tabWidget = new QTabWidget(); tabWidget->setUsesScrollButtons(true); tabWidget->setTabsClosable(true); tabWidget->setElideMode(Qt::ElideRight); for (int i = 1; i <= 10; ++i) { QWidget *tab = new QWidget(); QVBoxLayout *tabLayout = new QVBoxLayout(tab); QLabel *label = new QLabel(QString("This is the content for Tab %1").arg(i)); tabLayout->addWidget(label); tabWidget->addTab(tab, QString("Tab %1 with Long Title").arg(i)); } layout->addWidget(tabWidget); mainWindow.show(); return app.exec(); }