本文整理汇总了Python中PyQt4.QtGui.QBoxLayout.setContentsMargins方法的典型用法代码示例。如果您正苦于以下问题:Python QBoxLayout.setContentsMargins方法的具体用法?Python QBoxLayout.setContentsMargins怎么用?Python QBoxLayout.setContentsMargins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QBoxLayout
的用法示例。
在下文中一共展示了QBoxLayout.setContentsMargins方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent=None):
super(XDockToolbar, self).__init__(parent)
# defines the position for this widget
self._currentAction = -1
self._selectedAction = None
self._padding = 8
self._position = XDockToolbar.Position.South
self._minimumPixmapSize = QSize(16, 16)
self._maximumPixmapSize = QSize(48, 48)
self._hoverTimer = QTimer()
self._hoverTimer.setSingleShot(True)
self._hoverTimer.setInterval(1000)
self._actionHeld = False
self._easingCurve = QEasingCurve(QEasingCurve.InOutQuad)
self._duration = 200
self._animating = False
# install an event filter to update the location for this toolbar
layout = QBoxLayout(QBoxLayout.LeftToRight)
layout.setContentsMargins(2, 2, 2, 2)
layout.setSpacing(0)
layout.addStretch(1)
layout.addStretch(1)
self.setLayout(layout)
self.setContentsMargins(2, 2, 2, 2)
self.setMouseTracking(True)
parent.window().installEventFilter(self)
parent.window().statusBar().installEventFilter(self)
self._hoverTimer.timeout.connect(self.emitActionHovered)
示例2: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import setContentsMargins [as 别名]
def __init__(self, actions=None, parent=None,
direction=QBoxLayout.LeftToRight):
QWidget.__init__(self, parent)
self.actions = []
self.buttons = []
layout = QBoxLayout(direction)
layout.setContentsMargins(0, 0, 0, 0)
self.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
if actions is not None:
for action in actions:
self.addAction(action)
self.setLayout(layout)
示例3: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import setContentsMargins [as 别名]
def __init__( self, parent = None ):
super(XActionGroupWidget, self).__init__( parent )
# define custom properties
self._actionGroup = None
self._padding = 5
self._cornerRadius = 10
# set default properties
layout = QBoxLayout(QBoxLayout.LeftToRight)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)
self.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Preferred )
self.setLayout(layout)
示例4: __init__
# 需要导入模块: from PyQt4.QtGui import QBoxLayout [as 别名]
# 或者: from PyQt4.QtGui.QBoxLayout import setContentsMargins [as 别名]
def __init__(self, parent):
QToolBar.__init__(self, parent)
assert parent
self.dock = parent
# a fake spacer widget
w = QWidget(self)
l = QHBoxLayout(w)
l.setMargin(0)
l.setSpacing(0)
l.addStretch()
frame = QFrame()
layout = QBoxLayout(QBoxLayout.LeftToRight, frame)
layout.setContentsMargins(4, 4, 0, 0)
layout.setSpacing(2)
self.aDockFrame = self.addWidget(frame)
self.__icon = QLabel()
layout.addWidget(self.__icon)
layout.addWidget(QLabel(self.dock.windowTitle()))
self.dock.windowIconChanged.connect(self.__setWindowIcon)
# fake spacer item
spacer = QWidgetAction(self)
spacer.setDefaultWidget(w)
self.setMovable(False)
self.setFloatable(False)
self.setIconSize(QSize(12, 12))
self.aFloat = QAction(self)
self.aClose = QAction(self)
QToolBar.addAction(self, spacer)
self.separator = QToolBar.addSeparator(self)
QToolBar.addAction(self, self.aFloat)
QToolBar.addAction(self, self.aClose)
self.updateStandardIcons()
self.dockWidgetFeaturesChanged(self.dock.features())
self.dock.featuresChanged.connect(self.dockWidgetFeaturesChanged)
self.aFloat.triggered.connect(self._floatTriggered)
self.aClose.triggered.connect(self.dock.close)