예제 #1
0
    def selectSetting(self, tabName):
        """ Highlights a settingsName within the 
            text of the object.
        """

        #--------------------
        # Get the text of the widget
        # then find the index of the 'tabName'
        #--------------------
        text = self.toPlainText()
        tabNameIndex = text.find(tabName)

        #--------------------
        # Make a cursor, then manually highlight
        # the text based on the index name and text length.
        #--------------------
        cursor = qt.QTextCursor(self.textCursor())
        cursor.setPosition(tabNameIndex, 0)
        cursor.setPosition(tabNameIndex + len(tabName), 1)
        self.setTextCursor(cursor)

        #--------------------
        # Run event method.
        #--------------------
        self.onTextSelected()
예제 #2
0
    def mouseReleaseEvent(self, event):
        """ After the user clicks on a given line.
        """

        #--------------------
        # Define a cursor and select the line
        # that the cursor clicked on.
        #--------------------
        cursor = qt.QTextCursor(self.textCursor())
        cursor.select(qt.QTextCursor.LineUnderCursor)

        #--------------------
        # Select the text.
        #--------------------
        self.setTextCursor(cursor)

        #--------------------
        # Run event method.
        #--------------------
        self.onTextSelected()