本文整理匯總了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)