本文整理汇总了Python中PyQt4.QtGui.QLinearGradient.setFinalStart方法的典型用法代码示例。如果您正苦于以下问题:Python QLinearGradient.setFinalStart方法的具体用法?Python QLinearGradient.setFinalStart怎么用?Python QLinearGradient.setFinalStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QLinearGradient
的用法示例。
在下文中一共展示了QLinearGradient.setFinalStart方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: paintEvent
# 需要导入模块: from PyQt4.QtGui import QLinearGradient [as 别名]
# 或者: from PyQt4.QtGui.QLinearGradient import setFinalStart [as 别名]
def paintEvent(self, event):
"""
Paints the background for the dock toolbar.
:param event | <QPaintEvent>
"""
x = 1
y = 1
w = self.width()
h = self.height()
clr_a = QColor(220, 220, 220)
clr_b = QColor(190, 190, 190)
grad = QLinearGradient()
grad.setColorAt(0.0, clr_a)
grad.setColorAt(0.6, clr_a)
grad.setColorAt(1.0, clr_b)
# adjust the coloring for the horizontal toolbar
if self.position() & (self.Position.North | self.Position.South):
h = self.minimumPixmapSize().height() + 6
if self.position() == self.Position.South:
y = self.height() - h
grad.setStart(0, y)
grad.setFinalStop(0, self.height())
else:
grad.setStart(0, 0)
grad.setFinalStart(0, h)
# adjust the coloring for the vertical toolbar
if self.position() & (self.Position.East | self.Position.West):
w = self.minimumPixmapSize().width() + 6
if self.position() == self.Position.West:
x = self.width() - w
grad.setStart(x, 0)
grad.setFinalStop(self.width(), 0)
else:
grad.setStart(0, 0)
grad.setFinalStop(w, 0)
painter = QPainter(self)
painter.fillRect(x, y, w, h, grad)
# show the active action
action = self.selectedAction()
if action is not None and \
not self.currentAction() and \
not self._animating:
for lbl in self.actionLabels():
if lbl.action() != action:
continue
geom = lbl.geometry()
size = lbl.pixmapSize()
if self.position() == self.Position.North:
x = geom.left()
y = 0
w = geom.width()
h = size.height() + geom.top() + 2
elif self.position() == self.Position.East:
x = 0
y = geom.top()
w = size.width() + geom.left() + 2
h = geom.height()
painter.setPen(QColor(140, 140, 40))
painter.setBrush(QColor(160, 160, 160))
painter.drawRect(x, y, w, h)
break