当前位置: 首页>>代码示例>>Python>>正文


Python QToolTip.hideText方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QToolTip.hideText方法的典型用法代码示例。如果您正苦于以下问题:Python QToolTip.hideText方法的具体用法?Python QToolTip.hideText怎么用?Python QToolTip.hideText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QToolTip的用法示例。


在下文中一共展示了QToolTip.hideText方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: execute_queries

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
    def execute_queries(self, query=''):
        """ This function executes queries """

        # Hide tooltip if visible
        if QToolTip.isVisible():
            QToolTip.hideText()

        # If text is selected, then this text is the query,
        # otherwise the query is all text that has the editor
        editor_widget = self.currentWidget().get_editor()
        if editor_widget.textCursor().hasSelection():
            query = editor_widget.textCursor().selectedText()
        else:
            query = editor_widget.toPlainText()

        relations = self.currentWidget().relations
        central = Pireal.get_service("central")
        table_widget = central.get_active_db().table_widget

        # Restore
        relations.clear()
        self.currentWidget().clear_results()

        # Parse query
        sc = scanner.Scanner(query)
        lex = lexer.Lexer(sc)
        try:
            par = parser.Parser(lex)
            interpreter = parser.Interpreter(par)
            interpreter.clear()
            interpreter.to_python()
        except Exception as reason:
            pireal = Pireal.get_service("pireal")
            pireal.show_error_message(self.parse_error(reason.__str__()))
            return
        relations.update(table_widget.relations)
        for relation_name, expression in list(interpreter.SCOPE.items()):
            if relation_name in relations:
                QMessageBox.critical(self,
                                     self.tr("Query Error"),
                                     self.tr("<b>{}</b> is a duplicate "
                                             "relation name.<br><br> "
                                             "Please choose a unique name "
                                             "and re-execute the "
                                             "queries.".format(
                                                 relation_name)))
                del interpreter.SCOPE[relation_name]
                return
            try:
                new_relation = eval(expression, {}, relations)

            except Exception as reason:
                pireal = Pireal.get_service("pireal")
                pireal.show_error_message(self.parse_error(reason.__str__()),
                                          syntax_error=False)
                return

            relations[relation_name] = new_relation
            self.__add_table(new_relation, relation_name)
开发者ID:centaurialpha,项目名称:pireal,代码行数:61,代码来源:query_container.py

示例2: event

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
 def event(self, e):
     action = self.activeAction()
     if e.type() == QEvent.ToolTip and \
         action                    and \
         action.toolTip() != action.text():
             QToolTip.showText(e.globalPos(),
                               self.activeAction().toolTip())
     else:
         QToolTip.hideText()
     return super(Menu, self).event(e)
开发者ID:Mechtilde,项目名称:backintime,代码行数:12,代码来源:qttools.py

示例3: event

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
    def event(self, event):
        if event.type() == QEvent.ToolTip:
            helpEvent = event
            index = self.itemAt(helpEvent.pos())
            if index != -1:
                QToolTip.showText(helpEvent.globalPos(), self.shapeItems[index].toolTip())
            else:
                QToolTip.hideText()
                event.ignore()

            return True

        return super(SortingBox, self).event(event)
开发者ID:Magdno1,项目名称:Arianrhod,代码行数:15,代码来源:tooltips.py

示例4: mouseMoveEvent

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
    def mouseMoveEvent(self, event):
        textEditView.mouseMoveEvent(self, event)

        onRef = [r for r in self.refRects if r.contains(event.pos())]

        if not onRef:
            qApp.restoreOverrideCursor()
            QToolTip.hideText()
            return

        cursor = self.cursorForPosition(event.pos())
        ref = self.refUnderCursor(cursor)
        if ref:
            if not qApp.overrideCursor():
                qApp.setOverrideCursor(Qt.PointingHandCursor)
            QToolTip.showText(self.mapToGlobal(event.pos()), Ref.tooltip(ref))
开发者ID:TenKeyAngle,项目名称:manuskript,代码行数:18,代码来源:textEditCompleter.py

示例5: updateKineticCursor

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
 def updateKineticCursor(self, active):
     """Cursor handling when kinetic move starts/stops.
     
     - reset the cursor and hide tooltips if visible at start,
     - update the cursor and show the appropriate tooltips at stop.
     
     Used as a slot linked to the kineticStarted() signal.
     """
     if active:
         self.unsetCursor()
         if QToolTip.isVisible():
             QToolTip.hideText()
     else:
         self.updateCursor(QCursor.pos())
         if self._linksEnabled:
             page, link = self.pageLayout().linkAt(self.mapFromGlobal(QCursor.pos()))
             if link:
                 self.linkHelpEvent(QCursor.pos(), page, link)
开发者ID:AlexSchr,项目名称:frescobaldi,代码行数:20,代码来源:surface.py

示例6: mouseMoveEvent

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
 def mouseMoveEvent(self, ev):
     """Track the mouse move to show the tooltip"""
     super(View, self).mouseMoveEvent(ev)
     cursor_at_mouse = self.cursorForPosition(ev.pos())
     cur_block = cursor_at_mouse.block()
     # Only check tooltip when changing line/block or after invalidating
     if self.include_target or not cur_block == self.block_at_mouse:
         self.block_at_mouse = cur_block
         self.include_target = open_file_at_cursor.includeTarget(cursor_at_mouse)
         if self.include_target:
             if ev.modifiers() == Qt.ControlModifier:
                self.viewport().setCursor(QCursor(Qt.PointingHandCursor))
             self.showIncludeToolTip()
         else:
             self.include_target = []
             self.block_at_mouse = None
             self.viewport().setCursor(Qt.IBeamCursor)
             QToolTip.hideText()
开发者ID:19joho66,项目名称:frescobaldi,代码行数:20,代码来源:view.py

示例7: helpEvent

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
    def helpEvent(self, event, view, option, index):
        if not event or not view:
            return False

        if event.type() == QEvent.ToolTip:
            rect = view.visualRect(index)
            size = self.sizeHint(option, index)

            if rect.width() < size.width():
                tooltip = index.data(Qt.DisplayRole)

                QToolTip.showText(event.globalPos(), tooltip)
                return True

            if not QStyledItemDelegate.helpEvent(self, event, view, option, index):
                QToolTip.hideText()

            return True

        return QStyledItemDelegate.helpEvent(self, event, view, option, index)
开发者ID:dita-dev-team,项目名称:youtube-dl-gui,代码行数:22,代码来源:custom_widgets.py

示例8: viewportEvent

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
 def viewportEvent(self, event):
     if event.type() == QEvent.ToolTip:
         pos = event.pos()
         tc = self.cursorForPosition(pos)
         block = tc.block()
         line = block.layout().lineForTextPosition(tc.positionInBlock())
         if line.isValid():
             if pos.x() <= self.blockBoundingRect(block).left() + \
                     line.naturalTextRect().right():
                 column = tc.positionInBlock()
                 line = self.line_from_position(pos.y())
                 checkers = self._neditable.sorted_checkers
                 for items in checkers:
                     checker, _, _ = items
                     messages_for_line = checker.message(line)
                     if messages_for_line is not None:
                         for (start, end), message, content in \
                                 messages_for_line:
                             if column >= start and column <= end:
                                 QToolTip.showText(
                                     self.mapToGlobal(pos), message, self)
                 return True
             QToolTip.hideText()
     return super().viewportEvent(event)
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:26,代码来源:editor.py

示例9: hide_tool_tip

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
 def hide_tool_tip(self, e):
     QToolTip.hideText()
开发者ID:jhavstad,项目名称:model_runner,代码行数:4,代码来源:PyQtDnd.py

示例10: hide_tooltip

# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import hideText [as 别名]
 def hide_tooltip(self):
     QToolTip.hideText()
开发者ID:ninja-ide,项目名称:ninja-ide,代码行数:4,代码来源:editor.py


注:本文中的PyQt5.QtWidgets.QToolTip.hideText方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。