【发布时间】:2016-04-03 03:21:11
【问题描述】:
情况:
我正在研究以这种方式构建的 Qt4 应用程序(以防父小部件在此问题中很重要):
QApplication
|_ QMainwindow
|_ QScrollArea (central widget)
|_ QFrame (child of scroll area)
|_ QFrame
| |_ QLabel
| |_ QPixmap
|_ QFrame
| |_ QLabel
| |_ QPixmap
|_ QFrame
|_ ect...
目标:
我希望 sub-QFrames 和它们的 QLabels 之间没有边距,并且在 QLabels 和它们的 QPixmap 之间没有边距。
方法:
我已请求使用 QFrame.setContentsMargins(0, 0, 0, 0) 及其布局的 QBoxLayout.setSpacing(0) 来减少子 QFrame 的边距。 QLabel 与其 QPixmap 之间的零边距似乎很自然。
问题:
尽管如此,QFrames 中的边距仍然出现:我已经能够通过将样式表应用于各种小部件来测试这种情况。
我能做什么?
【问题讨论】: