コード例 #1
0
    def initScale(self, align):
        self.__data = QwtScaleWidget_PrivateData()
        self.__data.layoutFlags = 0
        if align == QwtScaleDraw.RightScale:
            self.__data.layoutFlags |= self.TitleInverted

        self.__data.borderDist = [0, 0]
        self.__data.minBorderDist = [0, 0]
        self.__data.margin = 4
        self.__data.titleOffset = 0
        self.__data.spacing = 2

        self.__data.scaleDraw = QwtScaleDraw()
        self.__data.scaleDraw.setAlignment(align)
        self.__data.scaleDraw.setLength(10)
        
        self.__data.scaleDraw.setScaleDiv(
                    QwtLinearScaleEngine().divideScale(0.0, 100.0, 10, 5))
        
        self.__data.colorBar.colorMap = QwtLinearColorMap()
        self.__data.colorBar.isEnabled = False
        self.__data.colorBar.width = 10
        
        flags = Qt.AlignmentFlag(Qt.AlignHCenter|Qt.TextExpandTabs|Qt.TextWordWrap)
        self.__data.title.setRenderFlags(flags)
        self.__data.title.setFont(self.font())
        
        policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        if self.__data.scaleDraw.orientation() == Qt.Vertical:
            policy.transpose()
        
        self.setSizePolicy(policy)
        
        self.setAttribute(Qt.WA_WState_OwnSizePolicy, False)
コード例 #2
0
    def initScale(self, align):
        self.__data = QwtScaleWidget_PrivateData()
        self.__data.layoutFlags = 0
        if align == QwtScaleDraw.RightScale:
            self.__data.layoutFlags |= self.TitleInverted

        self.__data.borderDist = [0, 0]
        self.__data.minBorderDist = [0, 0]
        self.__data.margin = 4
        self.__data.titleOffset = 0
        self.__data.spacing = 2

        self.__data.scaleDraw = QwtScaleDraw()
        self.__data.scaleDraw.setAlignment(align)
        self.__data.scaleDraw.setLength(10)

        self.__data.scaleDraw.setScaleDiv(QwtLinearScaleEngine().divideScale(
            0.0, 100.0, 10, 5))

        self.__data.colorBar.colorMap = QwtLinearColorMap()
        self.__data.colorBar.isEnabled = False
        self.__data.colorBar.width = 10

        flags = Qt.AlignmentFlag(Qt.AlignHCenter | Qt.TextExpandTabs
                                 | Qt.TextWordWrap)
        self.__data.title.setRenderFlags(flags)
        self.__data.title.setFont(self.font())

        policy = QSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)
        if self.__data.scaleDraw.orientation() == Qt.Vertical:
            policy.transpose()

        self.setSizePolicy(policy)

        self.setAttribute(Qt.WA_WState_OwnSizePolicy, False)
コード例 #3
0
 def setAlignment(self, alignment):
     if self.__data.scaleDraw:
         self.__data.scaleDraw.setAlignment(alignment)
     if not self.testAttribute(Qt.WA_WState_OwnSizePolicy):
         policy = QSizePolicy(QSizePolicy.MinimumExpanding,
                              QSizePolicy.Fixed)
         if self.__data.scaleDraw.orientation() == Qt.Vertical:
             policy.transpose()
         self.setSizePolicy(policy)
         self.setAttribute(Qt.WA_WState_OwnSizePolicy, False)
     self.layoutScale()
コード例 #4
0
 def setAlignment(self, alignment):
     if self.__data.scaleDraw:
         self.__data.scaleDraw.setAlignment(alignment)
     if not self.testAttribute(Qt.WA_WState_OwnSizePolicy):
         policy = QSizePolicy(QSizePolicy.MinimumExpanding,
                              QSizePolicy.Fixed)
         if self.__data.scaleDraw.orientation() == Qt.Vertical:
             policy.transpose()
         self.setSizePolicy(policy)
         self.setAttribute(Qt.WA_WState_OwnSizePolicy, False)
     self.layoutScale()
コード例 #5
0
ファイル: scale_widget.py プロジェクト: gyenney/Tools
 def setAlignment(self, alignment):
     """
     Change the alignment
     
     :param int alignment: New alignment
     
     Valid alignment values: see :py:class:`qwt.scale_draw.QwtScaleDraw`
     
     .. seealso::
     
         :py:meth:`alignment()`
     """
     if self.__data.scaleDraw:
         self.__data.scaleDraw.setAlignment(alignment)
     if not self.testAttribute(Qt.WA_WState_OwnSizePolicy):
         policy = QSizePolicy(QSizePolicy.MinimumExpanding,
                              QSizePolicy.Fixed)
         if self.__data.scaleDraw.orientation() == Qt.Vertical:
             policy.transpose()
         self.setSizePolicy(policy)
         self.setAttribute(Qt.WA_WState_OwnSizePolicy, False)
     self.layoutScale()
コード例 #6
0
ファイル: scale_widget.py プロジェクト: gyenney/Tools
 def setAlignment(self, alignment):
     """
     Change the alignment
     
     :param int alignment: New alignment
     
     Valid alignment values: see :py:class:`qwt.scale_draw.QwtScaleDraw`
     
     .. seealso::
     
         :py:meth:`alignment()`
     """
     if self.__data.scaleDraw:
         self.__data.scaleDraw.setAlignment(alignment)
     if not self.testAttribute(Qt.WA_WState_OwnSizePolicy):
         policy = QSizePolicy(QSizePolicy.MinimumExpanding,
                              QSizePolicy.Fixed)
         if self.__data.scaleDraw.orientation() == Qt.Vertical:
             policy.transpose()
         self.setSizePolicy(policy)
         self.setAttribute(Qt.WA_WState_OwnSizePolicy, False)
     self.layoutScale()