示例#1
0
    def __init__(self, editor, parent=None):

        super(HighlightedTextEditDialog, self).__init__(parent)

        self.editor = editor
        self.textEdit = HighlightedTextEdit()
        self.textEdit.setCode(editor.getCode())

        self.textEdit.installEventFilter(self)

        okButton = QtGui.QPushButton("&OK")
        okButton.clicked.connect(self.updateText)

        cancelButton = QtGui.QPushButton("&Cancel")
        cancelButton.clicked.connect(self.reject)

        buttonLayout = QtGui.QHBoxLayout()
        buttonLayout.addStretch(1)
        buttonLayout.addWidget(okButton)
        buttonLayout.addWidget(cancelButton)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.textEdit)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)
示例#2
0
    def createWidget(self, parent):
        widget = HighlightedTextEdit(parent)

        # We install an event filter on the text editor to prevent the
        # contents from being modified outside the custom editor dialog.
        widget.installEventFilter(self)
        return widget
示例#3
0
    def __init__(self, editor, parent=None):

        QtGui.QDialog.__init__(self, parent)

        self.editor = editor
        self.textEdit = HighlightedTextEdit()
        self.textEdit.setCode(editor.getCode())

        self.textEdit.installEventFilter(self)

        okButton = QtGui.QPushButton("&OK")
        cancelButton = QtGui.QPushButton("&Cancel")

        self.connect(okButton, QtCore.SIGNAL("clicked()"), self.updateText)
        self.connect(cancelButton, QtCore.SIGNAL("clicked()"), self,
                     QtCore.SLOT("reject()"))

        buttonLayout = QtGui.QHBoxLayout()
        buttonLayout.addStretch(1)
        buttonLayout.addWidget(okButton)
        buttonLayout.addWidget(cancelButton)

        layout = QtGui.QVBoxLayout()
        layout.addWidget(self.textEdit)
        layout.addLayout(buttonLayout)
        self.setLayout(layout)