示例#1
0
 def mouseReleaseEvent(self, e):
     if e.button() == Qt.LeftButton:
         if self.__data.itemMode == QwtLegendData.Clickable:
             self.setDown(False)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             return
     QwtTextLabel.mouseReleaseEvent(self, e)
示例#2
0
 def mouseReleaseEvent(self, e):
     if e.button() == Qt.LeftButton:
         if self.__data.itemMode == QwtLegendData.Clickable:
             self.setDown(False)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             return
     QwtTextLabel.mouseReleaseEvent(self, e)
示例#3
0
 def mousePressEvent(self, e):
     if e.button() == Qt.LeftButton:
         if self.__data.itemMode == QwtLegendData.Clickable:
             self.setDown(True)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             self.setDown(not self.isDown())
             return
     QwtTextLabel.mousePressEvent(self, e)
示例#4
0
 def keyReleaseEvent(self, e):
     if e.key() == Qt.Key_Space:
         if self.__data.itemMode == QwtLegendData.Clickable:
             if not e.isAutoRepeat():
                 self.setDown(False)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             return
     QwtTextLabel.keyReleaseEvent(self, e)
示例#5
0
 def mousePressEvent(self, e):
     if e.button() == Qt.LeftButton:
         if self.__data.itemMode == QwtLegendData.Clickable:
             self.setDown(True)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             self.setDown(not self.isDown())
             return
     QwtTextLabel.mousePressEvent(self, e)
示例#6
0
 def keyReleaseEvent(self, e):
     if e.key() == Qt.Key_Space:
         if self.__data.itemMode == QwtLegendData.Clickable:
             if not e.isAutoRepeat():
                 self.setDown(False)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             return
     QwtTextLabel.keyReleaseEvent(self, e)
示例#7
0
 def keyPressEvent(self, e):
     if e.key() == Qt.Key_Space:
         if self.__data.itemMode == QwtLegendData.Clickable:
             if not e.isAutoRepeat():
                 self.setDown(True)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             if not e.isAutoRepeat():
                 self.setDown(not self.isDown())
             return
     QwtTextLabel.keyPressEvent(self, e)
示例#8
0
 def keyPressEvent(self, e):
     if e.key() == Qt.Key_Space:
         if self.__data.itemMode == QwtLegendData.Clickable:
             if not e.isAutoRepeat():
                 self.setDown(True)
             return
         elif self.__data.itemMode == QwtLegendData.Checkable:
             if not e.isAutoRepeat():
                 self.setDown(not self.isDown())
             return
     QwtTextLabel.keyPressEvent(self, e)
示例#9
0
    def setText(self, text):
        """
        Set the text to the legend item
        
        :param qwt.text.QwtText text: Text label

        .. seealso::
        
            :py:meth:`text()`
        """
        flags = Qt.AlignLeft | Qt.AlignVCenter | Qt.TextExpandTabs | Qt.TextWordWrap
        text.setRenderFlags(flags)
        QwtTextLabel.setText(self, text)
示例#10
0
    def setText(self, text):
        """
        Set the text to the legend item
        
        :param qwt.text.QwtText text: Text label

        .. seealso::
        
            :py:meth:`text()`
        """
        flags = Qt.AlignLeft|Qt.AlignVCenter|Qt.TextExpandTabs|Qt.TextWordWrap
        txt = text  #TODO: WTF?
        txt.setRenderFlags(flags)
        QwtTextLabel.setText(self, text)
示例#11
0
 def sizeHint(self):
     sz = QwtTextLabel.sizeHint(self)
     sz.setHeight(max([sz.height(), self.__data.icon.height() + 4]))
     if self.__data.itemMode != QwtLegendData.ReadOnly:
         sz += buttonShift(self)
         sz = sz.expandedTo(QApplication.globalStrut())
     return sz
示例#12
0
 def sizeHint(self):
     sz = QwtTextLabel.sizeHint(self)
     sz.setHeight(max([sz.height(), self.__data.icon.height()+4]))
     if self.__data.itemMode != QwtLegendData.ReadOnly:
         sz += buttonShift(self)
         sz = sz.expandedTo(QApplication.globalStrut())
     return sz
示例#13
0
 def sizeHint(self):
     """
     :return: a size hint
     """
     sz = QwtTextLabel.sizeHint(self)
     sz.setHeight(max([sz.height(), self.__data.icon.height() + 4]))
     if self.__data.itemMode != QwtLegendData.ReadOnly:
         sz += buttonShift(self)
     return sz
示例#14
0
 def setText(self, text):
     flags = Qt.AlignLeft | Qt.AlignVCenter | Qt.TextExpandTabs | Qt.TextWordWrap
     txt = text  #TODO: WTF?
     txt.setRenderFlags(flags)
     QwtTextLabel.setText(self, text)
示例#15
0
 def setText(self, text):
     flags = Qt.AlignLeft|Qt.AlignVCenter|Qt.TextExpandTabs|Qt.TextWordWrap
     txt = text  #TODO: WTF?
     txt.setRenderFlags(flags)
     QwtTextLabel.setText(self, text)
示例#16
0
    def __init__(self, *args):
        if len(args) == 0:
            title, parent = "", None
        elif len(args) == 1:
            if isinstance(args[0], QWidget) or args[0] is None:
                title = ""
                parent, = args
            else:
                title, = args
                parent = None
        elif len(args) == 2:
            title, parent = args
        else:
            raise TypeError("%s() takes 0, 1 or 2 argument(s) (%s given)"\
                            % (self.__class__.__name__, len(args)))
        QwtPlotDict.__init__(self)
        QFrame.__init__(self, parent)
        
        self.__layout_state = None
        
        self.__data = QwtPlot_PrivateData()
        from qwt.plot_layout import QwtPlotLayout
        self.__data.layout = QwtPlotLayout()
        self.__data.autoReplot = False
                
        self.setAutoReplot(True)
#        self.setPlotLayout(self.__data.layout)
        
        # title
        self.__data.titleLabel = QwtTextLabel(self)
        self.__data.titleLabel.setObjectName("QwtPlotTitle")
        self.__data.titleLabel.setFont(QFont(self.fontInfo().family(), 14,
                                             QFont.Bold))
        text = QwtText(title)
        text.setRenderFlags(Qt.AlignCenter|Qt.TextWordWrap)
        self.__data.titleLabel.setText(text)
        
        # footer
        self.__data.footerLabel = QwtTextLabel(self)
        self.__data.footerLabel.setObjectName("QwtPlotFooter")
        footer = QwtText()
        footer.setRenderFlags(Qt.AlignCenter|Qt.TextWordWrap)
        self.__data.footerLabel.setText(footer)
        
        # legend
        self.__data.legend = None
        
        # axis
        self.__axisData = []
        self.initAxesData()
        
        # canvas
        self.__data.canvas = QwtPlotCanvas(self)
        self.__data.canvas.setObjectName("QwtPlotCanvas")
        self.__data.canvas.installEventFilter(self)
        
        self.setSizePolicy(QSizePolicy.MinimumExpanding,
                           QSizePolicy.MinimumExpanding)
        
        self.resize(200, 200)
        
        focusChain = [self, self.__data.titleLabel, self.axisWidget(self.xTop),
                      self.axisWidget(self.yLeft), self.__data.canvas,
                      self.axisWidget(self.yRight),
                      self.axisWidget(self.xBottom), self.__data.footerLabel]
        
        for idx in range(len(focusChain)-1):
            qwtSetTabOrder(focusChain[idx], focusChain[idx+1], False)
        
        qwtEnableLegendItems(self, True)
示例#17
0
 def __init__(self, parent=None):
     QwtTextLabel.__init__(self, parent)
     self.__data = QwtLegendLabel_PrivateData()
     self.setMargin(MARGIN)
     self.setIndent(MARGIN)
示例#18
0
 def __init__(self, parent=None):
     QwtTextLabel.__init__(self, parent)
     self.__data = QwtLegendLabel_PrivateData()
     self.setMargin(MARGIN)
     self.setIndent(MARGIN)