且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在QScrollArea中隐藏滚动条?

更新时间:2023-01-14 11:06:02

您可以使用样式表将其隐藏. 使用height:0px;隐藏水平滚动条,并使用width=0px;隐藏垂直滚动条. 像这样:

You can hide it using a style sheet. Use height:0px; to hide the horizontal scroll bar and width=0px; to hide the vertical scroll bar. Like that:

horizontalScrollBar()->setStyleSheet("QScrollBar {height:0px;}");
verticalScrollBar()->setStyleSheet("QScrollBar {width:0px;}");

瞧!没有滚动条,您仍然可以使用setValue()对其进行操作.

And voila!.No scroll bars, and you can still manipulate them using setValue().