本文整理汇总了Python中PySide.QtGui.QColor.fromRgbF方法的典型用法代码示例。如果您正苦于以下问题:Python QColor.fromRgbF方法的具体用法?Python QColor.fromRgbF怎么用?Python QColor.fromRgbF使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QColor
的用法示例。
在下文中一共展示了QColor.fromRgbF方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: paintEvent
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def paintEvent(self, ev):
if self.isEnabled():
color = self.color
colorBorder = [0.4, 0.4, 0.4]
else:
color = [0.8, 0.8, 0.8]
colorBorder = [0.7, 0.7, 0.7]
painter = QPainter(self)
painter.setRenderHint(QPainter.Antialiasing)
painter.setRenderHint(QPainter.HighQualityAntialiasing)
if self.isChecked():
pen = QPen(QColor.fromRgbF(0.2, 0.2, 0.2))
pen.setWidth(2.0)
else:
pen = QPen(QColor.fromRgbF(colorBorder[0], colorBorder[1], colorBorder[2]))
pen.setWidth(1.0)
size = self.size()
sizeCircle = 12.0
x = size.width() / 2.0 - (sizeCircle / 2.0)
y = size.height() / 2.0 - (sizeCircle / 2.0)
rect = QRectF(x, y, sizeCircle, sizeCircle)
painter.setPen(pen)
painter.setBrush(QColor.fromRgbF(color[0], color[1], color[2]))
painter.drawEllipse(rect)
示例2: loadContour
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def loadContour(self, contourData):
logging.debug("In CPRAction::loadContour()")
scenes = self._ilsa.scenes()
contour = CPRContour(scenes, self._ilsa, self.cprClosed)
for scene in scenes:
if contourData["sceneId"] == scene.id:
contour.scene = scene
elif contourData["panoramicSceneId"] == scene.id:
contour.setPanoramicPlane(scene.parent)
elif contourData["transversalSceneId"] == scene.id:
contour.setTransversalPlane(scene.parent)
self.propertiesAction.addContour(contour)
contour.loadPoints(contourData["points"])
lc = contourData["lineColor"]
alc = contourData["actualLineColor"]
ts = contourData["transversalSize"]
lineColor = QColor.fromRgbF(lc[0], lc[1], lc[2])
actualLineColor = QColor.fromRgbF(alc[0], alc[1], alc[2])
self.propertiesAction.changeLineColor(lineColor)
self.propertiesAction.changeActualLineColor(actualLineColor)
contour.setTransversalSize(ts)
self.propertiesAction.slotActionVisible(contourData["visible"])
self.propertiesAction.slotActionLock(contourData["locked"])
self.propertiesAction.lock.setChecked(contourData["locked"])
示例3: test_filter_list_item_has_icon
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def test_filter_list_item_has_icon(self):
file_names = [os.path.abspath('hi.txt')]
color = QColor.fromRgbF(.5, .6, .4, .34)
item = FilterListItem(file_names, color=color)
icon = item.icon()
self.assertIsNotNone(icon)
self.assertFalse(icon.isNull())
示例4: loadContour
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def loadContour(self, contourData):
logging.debug("In MarkAction::loadContour()")
scenes = self._ilsa.scenes()
replyList = []
for scene in scenes:
if isinstance(scene, VtkMultiSliceImagePlane):
contour = MultiSliceContour(scene)
else:
contour = Contour(scene)
replyList.append(contour)
self.propertiesAction.addContour(replyList[0])
for i, scene in enumerate(scenes):
a = replyList[:]
b = a.pop(i)
b.replyList = a
contour.loadPoints(contourData["points"])
lc = contourData["lineColor"]
lineColor = QColor.fromRgbF(lc[0], lc[1], lc[2])
self.propertiesAction.changeLineColor(lineColor)
self.propertiesAction.slotActionVisible(contourData["visible"])
self.propertiesAction.slotActionLock(contourData["locked"])
self.propertiesAction.lock.setChecked(contourData["locked"])
self.propertiesAction.slotThicknessChanged(contourData["radius"])
示例5: __init__
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def __init__(self, size, dynamic, controller):
layer.__init__(self,size,dynamic)
self.controller = controller
self.ready = False
dotColor = QColor()
dotColor.setNamedColor(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill'))
dotColor.setAlphaF(float(self.controller.svgLayer.svg.dotPrototype.getAttribute('fill-opacity')))
self.dotColors = []
i = 0
while i <= 1.0:
self.dotColors.append(QColor.fromRgbF(dotColor.redF(),dotColor.greenF(),dotColor.blueF(),i))
i += dotColor.alphaF()
self.dotWidth = self.controller.svgLayer.svg.dotPrototype.width()
self.dotHeight = self.controller.svgLayer.svg.dotPrototype.height()
self.halfDotWidth = self.dotWidth/2
self.halfDotHeight = self.dotHeight/2
self.xoffset = self.controller.scatterBounds[0]-self.halfDotWidth
self.yoffset = self.controller.scatterBounds[3]-self.halfDotHeight
self.xNonNumeric = (self.controller.svgLayer.svg.xNonNumericIcon.left() + self.controller.svgLayer.svg.xNonNumericIcon.right())/2 - self.halfDotWidth
self.yNonNumeric = (self.controller.svgLayer.svg.yNonNumericIcon.top() + self.controller.svgLayer.svg.yNonNumericIcon.bottom())/2 - self.halfDotHeight
示例6: test_filter_list_item_color
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def test_filter_list_item_color(self):
file_names = [os.path.abspath('hi.txt')]
color = QColor.fromRgbF(1., 1., 1., 1.)
item = FilterListItem(file_names, color=color)
color_check = item.get_params()['color']
self.assertEqual(color, color_check)
示例7: setUp
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def setUp(self):
self.original = QColor.fromRgbF(0.2, 0.3, 0.4, 0.5)
示例8: updateColor
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def updateColor(self, color):
self._brushNormal.setColor(QColor.fromRgbF(color[0], color[1], color[2]))
self._brushHighlighted.setColor(QColor.fromRgbF(color[0], color[1], color[2]))
self.update(self.rect())
示例9: testReduceRGB
# 需要导入模块: from PySide.QtGui import QColor [as 别名]
# 或者: from PySide.QtGui.QColor import fromRgbF [as 别名]
def testReduceRGB(self):
self.reduceColor(QColor.fromRgbF(0.1, 0.2, 0.3, 0.4))