本文整理汇总了Python中PyQt5.QtWidgets.QToolTip.isVisible方法的典型用法代码示例。如果您正苦于以下问题:Python QToolTip.isVisible方法的具体用法?Python QToolTip.isVisible怎么用?Python QToolTip.isVisible使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QToolTip
的用法示例。
在下文中一共展示了QToolTip.isVisible方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute_queries
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import isVisible [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)
示例2: updateKineticCursor
# 需要导入模块: from PyQt5.QtWidgets import QToolTip [as 别名]
# 或者: from PyQt5.QtWidgets.QToolTip import isVisible [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)