Ejemplo n.º 1
0
    def event(self, event: QEvent) -> bool:
        if self._show_tooltip_on_hover and self.toolTip():
            if event.type() == QEvent.HoverEnter:
                QToolTip.showText(self.mapToGlobal(event.pos()), self.toolTip(), self)
            event.accept()

        return QLabel.event(self, event)
Ejemplo n.º 2
0
 def canvasMoveEvent(self, e):
     '''
     override, hide tooltip on moving the mouse
     '''
     if self.tip and self.canvas.underMouse():
         QToolTip.hideText()
         self.map_timer.start(700)
Ejemplo n.º 3
0
 def mouseMoveEvent(self, mouseEvent):
     """
     Override so that the tool tip can be shown immediately.
     :param mouseEvent: Mouse move event
     :type mouseEvent: QMouseEvent
     """
     QToolTip.showText(mouseEvent.globalPos(), self._user_tip, self)
Ejemplo n.º 4
0
 def show_tip(self):
     '''
     show the tooltip on the map
     '''
     if self.canvas.underMouse():
         QToolTip.showText(
             self.canvas.mapToGlobal(self.canvas.mouseLastXY()), self.tip,
             self.canvas)
Ejemplo n.º 5
0
 def mouseMoveEvent(self, event):
     QToolTip.showText(
         event.globalPos(),
         'Block logic expects pumps and valves to always\n'
         'have two junctions at their endpoints.\n'
         'The pump or valve, together with the two junctions,\n'
         'are then considered as a single block, and they are\n'
         'moved jointly when using the "Move element tool".', self,
         self.rect())
Ejemplo n.º 6
0
    def event(self, event: QEvent) -> bool:
        if self._show_tooltip_on_hover and self.toolTip():
            if event.type() == QEvent.HoverEnter:
                # noinspection PyUnresolvedReferences
                QToolTip.showText(self.mapToGlobal(event.pos()),
                                  self.toolTip(), self)
            event.accept()

        return QLabel.event(self, event)
    def canvasMoveEvent(self, event):
        if self.capturing:
            self.capture_position(event)
            self.show_rubberband()

            if self.canvas.underMouse():
                rect = self.selection_rect()
                if rect is not None:
                    QToolTip.showText(
                        self.canvas.mapToGlobal(self.canvas.mouseLastXY()),
                        self.tooltip_text(rect), self.canvas)
Ejemplo n.º 8
0
 def showToolTip(self):
     """
     
     """
     self.timerMapTips.stop()
     if self.canvas.underMouse():
         raster = self.parent.rasterComboBox.currentLayer()
         if raster:
             text = self.getPixelValue(raster)
             p = self.canvas.mapToGlobal(self.canvas.mouseLastXY())
             QToolTip.showText(p, text, self.canvas)
Ejemplo n.º 9
0
 def showSizeTip(self, _):
     """ Size Slider Tooltip Trick """
     self.style = self.sl_Size.style()
     self.opt = QStyleOptionSlider()
     self.sl_Size.initStyleOption(self.opt)
     rectHandle = self.style.subControlRect(self.style.CC_Slider, self.opt,
                                            self.style.SC_SliderHandle,
                                            self.sl_Size)
     self.tip_offset = QPoint(5, 15)
     pos_local = rectHandle.topLeft() + self.tip_offset
     pos_global = self.sl_Size.mapToGlobal(pos_local)
     QToolTip.showText(pos_global, str(self.sl_Size.value()) + " px", self)
Ejemplo n.º 10
0
 def showToolTip(self, qgsPoint):
     """
     
     """
     self.timerMapTips.stop()
     self.timerMapTips.start(6000)  # time in milliseconds
     if self.canvas.underMouse():
         raster = self.rasterComboBox.currentLayer()
         if raster:
             text = self.getPixelValue(qgsPoint, raster)
             p = self.canvas.mapToGlobal(self.canvas.mouseLastXY())
             QToolTip.showText(p, text, self.canvas)
Ejemplo n.º 11
0
    def showMapTip(self):
        self.timerMapTips.stop()

        # 表示する値を設定する。
        mappos = self.toMapCoordinates(self.canvas.mouseLastXY())
        value = mappos

        if value == None:
            return
        text = str(value)
        QToolTip.showText(self.canvas.mapToGlobal(self.canvas.mouseLastXY()),
                          text, self.canvas)
 def mouseMoveEvent(self, event):
     textCursor = self.cursorForPosition(event.pos())
     #word=self.textUnderCursor(textCursor)
     textCursor.select(QTextCursor.WordUnderCursor)
     word = textCursor.selectedText()
     #print(textCursor.position())
     if not word.endswith(' '):
         textCursor.setPosition(textCursor.position() + 1,
                                QTextCursor.KeepAnchor)
         word = textCursor.selectedText()
     if word.strip() != "" and (
             word.startswith("wd:") or word.startswith("wdt:")
             or re.match("[:]?(Q|P)[0-9]+$", word.replace(":", ""))):
         while re.match("[QP:0-9]", word[-1]):
             textCursor.setPosition(textCursor.position() + 1,
                                    QTextCursor.KeepAnchor)
             word = textCursor.selectedText()
         textCursor.setPosition(textCursor.position() - 1,
                                QTextCursor.KeepAnchor)
         word = textCursor.selectedText()
         if word.endswith(">"):
             textCursor.setPosition(textCursor.position() - 1,
                                    QTextCursor.KeepAnchor)
         word = textCursor.selectedText()
         print("Tooltip Word")
         if word in self.savedLabels:
             toolTipText = self.savedLabels[word]
         elif "wikidata" in word or word.startswith(
                 "wd:") or word.startswith("wdt:"):
             if "http" in word:
                 word = word[word.rfind("/") + 1:-1]
             self.savedLabels[word] = self.getLabelsForClasses(
                 [word.replace("wd:", "").replace("wdt:", "")],
                 self.selector.currentIndex())
             toolTipText = self.savedLabels[word]
         else:
             toolTipText = word
         if ":" in word and toolTipText != word:
             toolTipText = str(
                 word[str(word).index(":") + 1:]) + ":" + str(toolTipText)
         elif toolTipText != word:
             toolTipText = word + ":" + toolTipText
         # Put the hover over in an easy to read spot
         pos = self.cursorRect(self.textCursor()).bottomRight()
         # The pos could also be set to event.pos() if you want it directly under the mouse
         pos = self.mapToGlobal(pos)
         QToolTip.showText(event.screenPos().toPoint(), toolTipText)
Ejemplo n.º 13
0
 def canvasMoveEvent(self, e):
     if not self.startPoint:
         return
     self.endPoint = self.toMapCoordinates(e.pos())
     self.rubberBand.setToGeometry(
         QgsGeometry.fromPolyline(
             [QgsPoint(self.startPoint),
              QgsPoint(self.endPoint)]), None)
     if self.startPoint != self.endPoint:
         dist = self.distArea.measureLine(self.startPoint, self.endPoint)
         bearing = self.distArea.bearing(self.startPoint,
                                         self.endPoint) * 180 / pi
         if bearing < 0:
             bearing += 360.0
         text = u'{:.1f} m; {:.1f}\u00b0'.format(dist, bearing)
         QToolTip.showText(self.canvas.mapToGlobal(e.pos()), text,
                           self.canvas)
Ejemplo n.º 14
0
 def printHelp(self):
     QToolTip.showText(
         QCursor.pos(),
         tla.formatTooltip(self.superParent.helps['distributionPanel'][
             self.sender().objectName()]), None)
 def printHelp(self):
     QToolTip.showText(
         QCursor.pos(),
         tla.formatTooltip(self.superParent.superParent.
                           helps['chooseGeographicExtentOnMapDialog'][
                               self.sender().objectName()]), None)
Ejemplo n.º 16
0
 def printHelp(self):
     QToolTip.showText(QCursor.pos(), tla.formatTooltip(
         self.superParent.helps['contactListManagerWindow'][self.sender().objectName()]),
                       None)
 def printHelp(self):
     QToolTip.showText(
         QCursor.pos(),
         tla.formatTooltip(
             self.superParent.superParent.helps['chooseFreeKeywordDialog'][
                 self.sender().objectName()]), None)
Ejemplo n.º 18
0
 def canvasMoveEvent(self, e):
     QToolTip.hideText()
     self.timerMapTips.start(500)  # time in milliseconds
     self.showToolTip()
Ejemplo n.º 19
0
 def canvasMoveEvent(self, event):
     QToolTip.hideText()
     self.timerMapTips.start(self.ms)