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


Python QApplication.focusWidget方法代码示例

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


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

示例1: on_search_result_on_open

# 需要导入模块: from python_qt_binding.QtGui import QApplication [as 别名]
# 或者: from python_qt_binding.QtGui.QApplication import focusWidget [as 别名]
 def on_search_result_on_open(self, search_text, found, path, index):
     '''
     Like on_search_result, but skips the text in comments.
     '''
     if found:
         if self.tabWidget.currentWidget().filename != path:
             focus_widget = QApplication.focusWidget()
             self.on_load_request(path)
             focus_widget.setFocus()
         comment_start = self.tabWidget.currentWidget().document().find('<!--', index, QTextDocument.FindBackward)
         if not comment_start.isNull():
             comment_end = self.tabWidget.currentWidget().document().find('-->', comment_start)
             if not comment_end.isNull() and comment_end.position() > index + len(search_text):
                 # commented -> retrun
                 return
     self.on_search_result(search_text, found, path, index)
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:18,代码来源:editor.py

示例2: on_search_result

# 需要导入模块: from python_qt_binding.QtGui import QApplication [as 别名]
# 或者: from python_qt_binding.QtGui.QApplication import focusWidget [as 别名]
 def on_search_result(self, search_text, found, path, index):
     '''
     A slot to handle a found text. It goes to the position in the text and select
     the searched text. On new file it will be open.
     :param search_text: the searched text
     :type search_text: str
     :param found: the text was found or not
     :type found: bool
     :param path: the path of the file the text was found
     :type path: str
     :param index: the position in the text
     :type index: int
     '''
     if found:
         if self.tabWidget.currentWidget().filename != path:
             focus_widget = QApplication.focusWidget()
             self.on_load_request(path)
             focus_widget.setFocus()
         cursor = self.tabWidget.currentWidget().textCursor()
         cursor.setPosition(index, QTextCursor.MoveAnchor)
         cursor.movePosition(QTextCursor.NextCharacter, QTextCursor.KeepAnchor, len(search_text))
         self.tabWidget.currentWidget().setTextCursor(cursor)
开发者ID:fkie,项目名称:multimaster_fkie,代码行数:24,代码来源:editor.py


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