QTabWidget 有多行?
是否可以使 QTabWidget 表现得像 Windows 系统,当选项卡太多时使用多行?
我检查了qt的文档,似乎没有这样的东西可用。
Is it possible to make QTabWidget behave like windows system , use multiple line when there's just too much tabs ?
I checked qt's doc , seems no such thing was available.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要子类化
QTabWidget
或Widget
并自己实现此功能。如果您计划的选项卡数量多于一行(没有箭头或多行),我建议您考虑采用不同的方法。多行上的选项卡虽然很常见,但被广泛认为是糟糕的 UI 体验。带箭头的单行仅稍好一些:)You would need to subclass
QTabWidget
orWidget
and implement this functionality yourself. I would recommend that you consider a different approach if you plan more tabs than will conveniently all fit in a single line (without arrows or multiple rows). Tabs on multiple rows, although common enough, are widely considered to be a bad UI experience. A single row with arrows is only marginally better :)您将需要实现 QTabBar 以不同方式呈现线条,然后将 QTabWidget::setTabBar() 用于您的新实现。
You will need to implement QTabBar to render the lines differently, and then use QTabWidget::setTabBar() to your new implementation.