本文整理汇总了Python中PyQt5.QtWidgets.QScrollArea.setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:Python QScrollArea.setContentsMargins方法的具体用法?Python QScrollArea.setContentsMargins怎么用?Python QScrollArea.setContentsMargins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QScrollArea
的用法示例。
在下文中一共展示了QScrollArea.setContentsMargins方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PyntGui
# 需要导入模块: from PyQt5.QtWidgets import QScrollArea [as 别名]
# 或者: from PyQt5.QtWidgets.QScrollArea import setContentsMargins [as 别名]
class PyntGui(object):
pynt = None
AVATAR_SIZE = 60
AVATAR_DEFAULT = 'assets/example.org_user.jpg'
WINDOW_TITLE = 'Pynt, for #pants'
ICON_APP = 'assets/icons/pynt.png'
ICON_USER = 'assets/icons/rainbow.png'
ICON_TIME = 'assets/icons/time.png'
ICON_URL = 'assets/icons/connect.png'
def __init__(self, pynt):
self.pynt = pynt
self.bootstrap()
def bootstrap(self):
self.no_margin = QMargins(0, 0, 0, 0)
self.app = App()
self.app.setWindowIcon(QIcon(self.ICON_APP))
if platform.system() == 'Windows':
myappid = 'f5n.pynt.alpha'
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
self.scroll_area = QScrollArea()
self.scroll_area.setContentsMargins(self.no_margin)
self.scroll_area.setBackgroundRole(QPalette.Dark);
self.scroll_area.setWidgetResizable(True)
self.scroll_area.setWindowTitle(self.WINDOW_TITLE)
self.main_layout = QVBoxLayout()
self.main_layout.setSpacing(0)
self.main_layout.setContentsMargins(self.no_margin)
self.main_layout.addWidget(self.scroll_area)
self.contents = QWidget()
self.contents.setContentsMargins(self.no_margin)
self.contents.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
#self.contents.setScaledContents(True)
self.scroll_area.setWidget(self.contents)
self.layout = QVBoxLayout(self.contents)
self.layout.setSizeConstraint(QLayout.SetMinimumSize)
return self
def addStuff(self, posts):
for post in posts:
# xpanel holds one post
xpanel_layout = QHBoxLayout()
xpanel_layout.setSpacing(5)
xpanel_layout.setContentsMargins(self.no_margin)
xpanel = QFrame()
xpanel.setContentsMargins(self.no_margin)
xpanel.setLayout(xpanel_layout)
avatar_label = self.updated_avatar(self.AVATAR_DEFAULT)
# panel holds controls and view
panel_layout = QVBoxLayout()
panel_layout.setSpacing(0)
panel_layout.setContentsMargins(self.no_margin)
panel = QFrame()
panel.setLayout(panel_layout)
panel.setContentsMargins(self.no_margin)
panel.setStyleSheet("background-color:green;")
# control holds the controls at the top
control_layout = QHBoxLayout()
control_layout.setSpacing(0)
control_layout.setContentsMargins(self.no_margin)
controls = QFrame()
controls.setStyleSheet("background-color:#ffeeee;")
controls.setContentsMargins(self.no_margin)
controls.setLayout(control_layout)
# ctrl_ is inside control
ctrl_url = QPushButton()
ctrl_url.setContentsMargins(self.no_margin)
ctrl_url.setStyleSheet("QPushButton { color: black; }")
ctrl_url.setFlat(True)
ctrl_url.setIcon(QIcon(self.ICON_URL))
ctrl_updated = QPushButton()
ctrl_updated.setContentsMargins(self.no_margin)
ctrl_updated.setStyleSheet("color:#000000;")
ctrl_updated.setFlat(True)
ctrl_updated.setIcon(QIcon(self.ICON_TIME))
ctrl_user = QPushButton()
ctrl_user.setContentsMargins(self.no_margin)
ctrl_user.setStyleSheet("QPushButton { color: black; }")
ctrl_user.setFlat(True)
ctrl_user.setIcon(QIcon(self.ICON_USER))
# view displays HTML
view = WebView()
#view.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Maximum)
#.........这里部分代码省略.........