Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
是否可以让 QTabWidget 表现得像 windows 系统一样,当标签太多时使用多行?
我检查了 qt 的文档,似乎没有这样的东西可用。
您需要自己继承QTabWidget或Widget实现此功能。如果您计划的选项卡比方便地全部放在一行中(没有箭头或多行),我建议您考虑一种不同的方法。多行上的选项卡虽然很常见,但被广泛认为是糟糕的 UI 体验。带箭头的单行只是稍微好一点:)
QTabWidget
Widget
您将需要实现 QTabBar 以不同方式呈现线条,然后将 QTabWidget::setTabBar() 用于您的新实现。