本文整理汇总了Python中PyQt4.QtCore.QSize.expandedTo方法的典型用法代码示例。如果您正苦于以下问题:Python QSize.expandedTo方法的具体用法?Python QSize.expandedTo怎么用?Python QSize.expandedTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtCore.QSize
的用法示例。
在下文中一共展示了QSize.expandedTo方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: minimumSize
# 需要导入模块: from PyQt4.QtCore import QSize [as 别名]
# 或者: from PyQt4.QtCore.QSize import expandedTo [as 别名]
def minimumSize(self):
size = QSize()
for item in self.items:
size = size.expandedTo(item.minimumSize())
margin = self.margin()
size += QSize(2*margin, 2*margin)
return size
示例2: sizeHint
# 需要导入模块: from PyQt4.QtCore import QSize [as 别名]
# 或者: from PyQt4.QtCore.QSize import expandedTo [as 别名]
def sizeHint(self):
""" A virtual method implementation which returns the size hint
for the layout.
"""
if self._cached_hint is None:
size = QSize(0, 0)
for item in self._items:
size = size.expandedTo(item.sizeHint())
left, top, right, bottom = self.getContentsMargins()
size.setWidth(size.width() + left + right)
size.setHeight(size.height() + top + bottom)
self._cached_hint = size
return self._cached_hint
示例3: minimumSize
# 需要导入模块: from PyQt4.QtCore import QSize [as 别名]
# 或者: from PyQt4.QtCore.QSize import expandedTo [as 别名]
def minimumSize(self):
""" A reimplemented method which returns the minimum size hint
of the layout item widget as the minimum size of the window.
"""
if self._cached_min is None:
size = QSize(0, 0)
for item in self._items:
size = size.expandedTo(item.minimumSize())
left, top, right, bottom = self.getContentsMargins()
size.setWidth(size.width() + left + right)
size.setHeight(size.height() + top + bottom)
self._cached_min = size
# XXX hack! We really need hasWidthForHeight! This doesn't quite
# work because a QScrollArea internally caches the min size.
d = self._options.direction
if d == self.TopToBottom or d == self.BottomToTop:
m = QSize(self._cached_min)
if m.width() < self._cached_wfh:
m.setWidth(self._cached_wfh)
return m
return self._cached_min