本文整理汇总了Python中AnyQt.QtWidgets.QGraphicsWidget.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsWidget.__init__方法的具体用法?Python QGraphicsWidget.__init__怎么用?Python QGraphicsWidget.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnyQt.QtWidgets.QGraphicsWidget
的用法示例。
在下文中一共展示了QGraphicsWidget.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGraphicsWidget [as 别名]
# 或者: from AnyQt.QtWidgets.QGraphicsWidget import __init__ [as 别名]
def __init__(self, parent=None, direction=Qt.LeftToRight,
node=None, icon=None, iconSize=None, **args):
QGraphicsWidget.__init__(self, parent, **args)
self.setAcceptedMouseButtons(Qt.NoButton)
self.__direction = direction
self.setLayout(QGraphicsLinearLayout(Qt.Horizontal))
# Set the maximum size, otherwise the layout can't grow beyond its
# sizeHint (and we need it to grow so the widget can grow and keep the
# contents centered vertically.
self.layout().setMaximumSize(QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX))
self.setSizePolicy(QSizePolicy.MinimumExpanding,
QSizePolicy.MinimumExpanding)
self.__iconSize = iconSize or QSize(64, 64)
self.__icon = icon
self.__iconItem = QGraphicsPixmapItem(self)
self.__iconLayoutItem = GraphicsItemLayoutItem(item=self.__iconItem)
self.__channelLayout = QGraphicsGridLayout()
self.__channelAnchors = []
if self.__direction == Qt.LeftToRight:
self.layout().addItem(self.__iconLayoutItem)
self.layout().addItem(self.__channelLayout)
channel_alignemnt = Qt.AlignRight
else:
self.layout().addItem(self.__channelLayout)
self.layout().addItem(self.__iconLayoutItem)
channel_alignemnt = Qt.AlignLeft
self.layout().setAlignment(self.__iconLayoutItem, Qt.AlignCenter)
self.layout().setAlignment(self.__channelLayout,
Qt.AlignVCenter | channel_alignemnt)
if node is not None:
self.setSchemeNode(node)
示例2: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGraphicsWidget [as 别名]
# 或者: from AnyQt.QtWidgets.QGraphicsWidget import __init__ [as 别名]
def __init__(self, parent=None, rug=None):
QGraphicsWidget.__init__(self, parent)
self.rug_items = []
self.set_rug(rug)
self.setMaximumHeight(30)
self.setMinimumHeight(30)
示例3: __init__
# 需要导入模块: from AnyQt.QtWidgets import QGraphicsWidget [as 别名]
# 或者: from AnyQt.QtWidgets.QGraphicsWidget import __init__ [as 别名]
def __init__(self, parent=None, **kwargs):
QGraphicsWidget.__init__(self, parent, **kwargs)