m_tabbar = new QTabBar(this);
m_tabbar->setExpanding(false);
m_tabbar->setMovable(false);
m_tabbar->setUsesScrollButtons(false);
m_tabbar->addTab(QStringLiteral("123456"));
ui.stackedWidget->setCurrentIndex(0);
QScrollArea *scrollArea = new QScrollArea(this);
scrollArea->setWidgetResizable(false);
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setStyleSheet("QScrollArea { border: 0px; background: transparent;}");
/*********重点**********/
scrollArea->setWidget(m_tabbar);
/*********重点**********/
scrollArea->setFixedHeight(50);
【Qt】QStackedWidget的tabbar的手势滚动
最新推荐文章于 2024-09-08 16:35:22 发布