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


Python QTextCursor.select方法代码示例

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


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

示例1: load

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import select [as 别名]
    def load(self, url=None, encoding=None, keepUndo=False):
        """Load the specified or current url (if None was specified).

        Currently only local files are supported. An IOError is raised
        when trying to load a nonlocal URL.

        If loading succeeds and an url was specified, the url is made the
        current url (by calling setUrl() internally).

        If keepUndo is True, the loading can be undone (with Ctrl-Z).

        """
        if url is None:
            url = QUrl()
        u = url if not url.isEmpty() else self.url()
        text = self.load_data(u, encoding or self._encoding)
        if keepUndo:
            c = QTextCursor(self)
            c.select(QTextCursor.Document)
            c.insertText(text)
        else:
            self.setPlainText(text)
        self.setModified(False)
        if not url.isEmpty():
            self.setUrl(url)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:27,代码来源:document.py

示例2: add_debug_message

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import select [as 别名]
    def add_debug_message(self, message):
        self.text_debug.append(message)

        while self.text_debug.document().blockCount() > 1000:
            cursor = QTextCursor(self.text_debug.document().begin())
            cursor.select(QTextCursor.BlockUnderCursor)
            cursor.movePosition(QTextCursor.Right, QTextCursor.KeepAnchor)
            cursor.removeSelectedText()

        if self.checkbox_debug_auto_scroll.isChecked():
            self.text_debug.verticalScrollBar().setValue(self.text_debug.verticalScrollBar().maximum())
开发者ID:Tinkerforge,项目名称:brickv,代码行数:13,代码来源:setup_dialog.py

示例3: update_minimap_doc

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import select [as 别名]
    def update_minimap_doc(self, position, charsRemoved, charsAdded):

        def select_blocks(first_block,  last_block):
            first_block_pos = first_block.position()
            doc_cursor.setPosition(first_block_pos)
            last_block_pos = last_block.position()
            doc_cursor.setPosition(last_block_pos,  QTextCursor.KeepAnchor)
            doc_cursor.movePosition(
                QTextCursor.EndOfBlock,  QTextCursor.KeepAnchor)
            print("selected text :",  doc_cursor.selectedText())
            return doc_cursor.selectedText()

        doc_cursor = QTextCursor(self._doc)
        minimap_cursor = QTextCursor(self._minimap_doc)

        # IF one same block is modified
        if self._minimap_doc.blockCount() == self._doc.blockCount():
            doc_cursor.setPosition(position)
            doc_cursor.select(QTextCursor.BlockUnderCursor)
            minimap_cursor.setPosition(position)
            minimap_cursor.select(QTextCursor.BlockUnderCursor)
            minimap_cursor.insertFragment(doc_cursor.selection())
        # TODO: if the doc is modified on more than one block but resulting in
        # the same count of blocks (right now only the first block would be
        # updated)
        else:
            # ELSE
            doc_cursor.select(QTextCursor.Document)
            minimap_cursor.select(QTextCursor.Document)
            minimap_cursor.insertFragment(doc_cursor.selection())
开发者ID:ParaplegicRacehorse,项目名称:plume-creator,代码行数:32,代码来源:minimap_text_browser.py

示例4: post_import

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import select [as 别名]
    def post_import(self, settings, doc):
        """Adaptations of the source after running musicxml2ly

        Present settings:
        Reformat source
        Remove superfluous durations
        Remove duration scaling
        Engrave directly
        """
        cursor = QTextCursor(doc)
        if settings[0]:
            import reformat
            reformat.reformat(cursor)
        if settings[1]:
            cursor.select(QTextCursor.Document)
            from rhythm import rhythm
            rhythm.rhythm_implicit_per_line(cursor)
        if settings[2]:
            cursor.select(QTextCursor.Document)
            from rhythm import rhythm
            rhythm.rhythm_remove_fraction_scaling(cursor)
        if settings[3]:
            import engrave
            engrave.engraver(self.mainwindow()).engrave('preview', doc, False)
开发者ID:19joho66,项目名称:frescobaldi,代码行数:26,代码来源:__init__.py

示例5: get_find_range

# 需要导入模块: from PyQt5.QtGui import QTextCursor [as 别名]
# 或者: from PyQt5.QtGui.QTextCursor import select [as 别名]
 def get_find_range(self):
     tc = QTextCursor(self.range_sel.cursor) # copy of range cursor
     if not tc.hasSelection() :
         tc.select(QTextCursor.Document)
     return tc
开发者ID:B-Rich,项目名称:PPQT2,代码行数:7,代码来源:editview.py


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