本文整理汇总了Python中PyQt4.Qt.QFrame.setMinimumSize方法的典型用法代码示例。如果您正苦于以下问题:Python QFrame.setMinimumSize方法的具体用法?Python QFrame.setMinimumSize怎么用?Python QFrame.setMinimumSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.Qt.QFrame
的用法示例。
在下文中一共展示了QFrame.setMinimumSize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PM_ColorChooser
# 需要导入模块: from PyQt4.Qt import QFrame [as 别名]
# 或者: from PyQt4.Qt.QFrame import setMinimumSize [as 别名]
#.........这里部分代码省略.........
self.spanWidth = spanWidth
if label: # Create this widget's QLabel.
self.labelWidget = QLabel()
self.labelWidget.setText(label)
# Create the color frame (color swath) and "..." button.
self.colorFrame = QFrame()
self.colorFrame.setFrameShape(QFrame.Box)
self.colorFrame.setFrameShadow(QFrame.Plain)
# Set browse button text and make signal-slot connection.
self.chooseButton = QToolButton()
self.chooseButton.setText("...")
self.connect(self.chooseButton, SIGNAL("clicked()"), self.openColorChooserDialog)
# Add a horizontal spacer to keep the colorFrame and "..." squeezed
# together, even when the PM width changes.
self.hSpacer = QSpacerItem(10, 10,
QSizePolicy.MinimumExpanding,
QSizePolicy.Fixed)
# Create vertical box layout.
self.hBoxLayout = QHBoxLayout(self)
self.hBoxLayout.setMargin(0)
self.hBoxLayout.setSpacing(2)
self.hBoxLayout.insertWidget(-1, self.colorFrame)
self.hBoxLayout.insertWidget(-1, self.chooseButton)
# Set this to False to make the colorFrame an expandable rectangle.
COLORFRAME_IS_SQUARE = True
if COLORFRAME_IS_SQUARE:
squareSize = 20
self.colorFrame.setMinimumSize(QSize(squareSize, squareSize))
self.colorFrame.setMaximumSize(QSize(squareSize, squareSize))
self.hBoxLayout.addItem(self.hSpacer)
self.setColor(color, default = setAsDefault)
parentWidget.addPmWidget(self)
return
def setColor(self, color, default = False):
"""
Set the color.
@param color: The color.
@type color: tuple of 3 floats (r, g, b)
@param default: If True, make I{color} the default color. Default is
False.
@type default: boolean
"""
if default:
self.defaultColor = color
self.setAsDefault = default
self.color = color
self._updateColorFrame()
return
def getColor(self):
"""
Return the current color.
@return: The current r, g, b color.
@rtype: Tuple of 3 floats (r, g, b)