當前位置: 首頁>>代碼示例>>Python>>正文


Python QRectF.setX方法代碼示例

本文整理匯總了Python中qwt.qt.QtCore.QRectF.setX方法的典型用法代碼示例。如果您正苦於以下問題:Python QRectF.setX方法的具體用法?Python QRectF.setX怎麽用?Python QRectF.setX使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在qwt.qt.QtCore.QRectF的用法示例。


在下文中一共展示了QRectF.setX方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: renderItem

# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setX [as 別名]
    def renderItem(self, painter, widget, rect, fillBackground):
        """
        Render a legend entry into a given rectangle.

        :param QPainter painter: Painter
        :param QWidget widget: Widget representing a legend entry
        :param QRectF rect: Bounding rectangle
        :param bool fillBackground: When true, fill rect with the widget background
        """
        if fillBackground:
            if widget.autoFillBackground() or\
               widget.testAttribute(Qt.WA_StyledBackground):
                QwtPainter.drawBackground(painter, rect, widget)
        label = widget  #TODO: cast to QwtLegendLabel
        if label is not None:
            icon = label.data().icon()
            sz = icon.defaultSize()
            iconRect = QRectF(rect.x()+label.margin(),
                              rect.center().y()-.5*sz.height(),
                              sz.width(), sz.height())
            icon.render(painter, iconRect, Qt.KeepAspectRatio)
            titleRect = QRectF(rect)
            titleRect.setX(iconRect.right()+2*label.spacing())
            painter.setFont(label.font())
            painter.setPen(label.palette().color(QPalette.Text))
            label.drawText(painter, titleRect)  #TODO: cast label to QwtLegendLabel
開發者ID:gyenney,項目名稱:Tools,代碼行數:28,代碼來源:legend.py

示例2: layoutLegend

# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setX [as 別名]
 def layoutLegend(self, options, rect):
     """
     Find the geometry for the legend
     
     :param options: Options how to layout the legend
     :param QRectF rect: Rectangle where to place the legend
     :return: Geometry for the legend
     """
     hint = self.__data.layoutData.legend.hint
     if self.__data.legendPos in (QwtPlot.LeftLegend, QwtPlot.RightLegend):
         dim = min([hint.width(), int(rect.width()*self.__data.legendRatio)])
         if not (options & self.IgnoreScrollbars):
             if hint.height() > rect.height():
                 dim += self.__data.layoutData.legend.hScrollExtent
     else:
         dim = min([hint.height(), int(rect.height()*self.__data.legendRatio)])
         dim = max([dim, self.__data.layoutData.legend.vScrollExtent])
     legendRect = QRectF(rect)
     if self.__data.legendPos == QwtPlot.LeftLegend:
         legendRect.setWidth(dim)
     elif self.__data.legendPos == QwtPlot.RightLegend:
         legendRect.setX(rect.right()-dim)
         legendRect.setWidth(dim)
     elif self.__data.legendPos == QwtPlot.TopLegend:
         legendRect.setHeight(dim)
     elif self.__data.legendPos == QwtPlot.BottomLegend:
         legendRect.setY(rect.bottom()-dim)
         legendRect.setHeight(dim)
     return legendRect
開發者ID:berrosse,項目名稱:PythonQwt,代碼行數:31,代碼來源:plot_layout.py

示例3: renderItem

# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setX [as 別名]
 def renderItem(self, painter, widget, rect, fillBackground):
     if fillBackground:
         if widget.autoFillBackground() or\
            widget.testAttribute(Qt.WA_StyledBackground):
             QwtPainter.drawBackground(painter, rect, widget)
     label = widget  #TODO: cast to QwtLegendLabel
     if label is not None:
         icon = label.data().icon()
         sz = icon.defaultSize()
         iconRect = QRectF(rect.x()+label.margin(),
                           rect.center().y()-.5*sz.height(),
                           sz.width(), sz.height())
         icon.render(painter, iconRect, Qt.KeepAspectRatio)
         titleRect = QRectF(rect)
         titleRect.setX(iconRect.right()+2*label.spacing())
         painter.setFont(label.font())
         painter.setPen(label.palette().color(QPalette.Text))
         label.drawText(painter, titleRect)  #TODO: cast label to QwtLegendLabel
開發者ID:petebachant,項目名稱:python-qwt,代碼行數:20,代碼來源:legend.py

示例4: layoutLegend

# 需要導入模塊: from qwt.qt.QtCore import QRectF [as 別名]
# 或者: from qwt.qt.QtCore.QRectF import setX [as 別名]
 def layoutLegend(self, options, rect):
     hint = self.__data.layoutData.legend.hint
     if self.__data.legendPos in (QwtPlot.LeftLegend, QwtPlot.RightLegend):
         dim = min([hint.width(), int(rect.width()*self.__data.legendRatio)])
         if not (options & self.IgnoreScrollbars):
             if hint.height() > rect.height():
                 dim += self.__data.layoutData.legend.hScrollExtent
     else:
         dim = min([hint.height(), int(rect.height()*self.__data.legendRatio)])
         dim = max([dim, self.__data.layoutData.legend.vScrollExtent])
     legendRect = QRectF(rect)
     if self.__data.legendPos == QwtPlot.LeftLegend:
         legendRect.setWidth(dim)
     elif self.__data.legendPos == QwtPlot.RightLegend:
         legendRect.setX(rect.right()-dim)
         legendRect.setWidth(dim)
     elif self.__data.legendPos == QwtPlot.TopLegend:
         legendRect.setHeight(dim)
     elif self.__data.legendPos == QwtPlot.BottomLegend:
         legendRect.setY(rect.bottom()-dim)
         legendRect.setHeight(dim)
     return legendRect
開發者ID:petebachant,項目名稱:python-qwt,代碼行數:24,代碼來源:plot_layout.py


注:本文中的qwt.qt.QtCore.QRectF.setX方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。