当前位置: 首页>>代码示例>>Python>>正文


Python QLinearGradient.setFinalStart方法代码示例

本文整理汇总了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
开发者ID:satishgoda,项目名称:DPS_PIPELINE,代码行数:76,代码来源:xdocktoolbar.py


注:本文中的PyQt4.QtGui.QLinearGradient.setFinalStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。