QTextHtmlImporter isn't even part of the Qt4 API, so the short answer is: no, there's no way to access it in PyQt4.
QTextHtmlImporter isn't even part of the Qt4 API, so the short answer is: no, there's no way to access it in PyQt4. You could, of course, attempt to port the code to PyQt4, but I'm guessing that would be a non-trivial task. The question is: why do you think you need to do this?
Why can't you use QTextCursor. InsertHtml or QTextDocumentFragment. FromHtml?
EDIT Here's an example of how to set the html in a text document without clearing the undo history: from PyQt4 import QtGui, QtCore class Window(QtGui. QWidget): def __init__(self): QtGui.QWidget. __init__(self) layout = QtGui.
QVBoxLayout(self) self. Edit = QtGui. QTextEdit(self) self.
Undo = QtGui. QPushButton('Undo') self. Redo = QtGui.
QPushButton('Redo') self. Insert = QtGui. QPushButton('Set Html') layout.
AddWidget(self. Edit) layout. AddWidget(self.
Undo) layout. AddWidget(self. Redo) layout.
AddWidget(self. Insert) self.undo.clicked. Connect(self.edit.
Undo) self.redo.clicked. Connect(self.edit. Redo) self.insert.clicked.
Connect(self. HandleInsert) self.edit. Append('One') self.edit.
Append('Two') self.edit. Append('Three') def handleInsert(self): cursor = QtGui. QTextCursor(self.edit.document()) cursor.
Select(QtGui.QTextCursor. Document) cursor. InsertHtml("""Some HTML text""") if __name__ == '__main__': import sys app = QtGui.
QApplication(sys. Argv) win = Window() win.show() sys. Exit(app.
Exec_()).
How QTextDocument.setHtml() works is like below void QTextDocument::setHtml(const QString &html) { Q_D(QTextDocument); setUndoRedoEnabled(false); d->clear(); QTextHtmlImporter(this, html).import(); setUndoRedoEnabled(true); } I would like to modify it to void QTextDocument::setHtml(const QString &html) { Q_D(QTextDocument); QTextHtmlImporter(this, html).import(); } Basically setting the html without clearing the history. I planned to do this by using a derived class of PyQt4's QtextDocument overriding the setHtml function. Is there any other way to do this?
– Sharmila Nov 2 at 1:13 @Sharmila. I've updated my answer with a basic example of how to do this. – ekhumoro Nov 2 at 12:58 Wouldn't cursor.
Select(QtGui.QTextCursor. Document) do the same thing as the 2 calls to movePosition? – alexisdm Nov 2 at 13:17 @alexisdm.
Yes - I've edited it now. – ekhumoro Nov 2 at 13:37 @ekhumoro worked like a charm. Thank you so much!
– Sharmila Nov 27 at 10:57.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.