[PyQt] Please tell me if I have this straight...
    David Cortesi 
    davecortesi at gmail.com
       
    Fri Aug  5 19:27:51 BST 2011
    
    
  
I present a document to a user in a QPlainTextEdit widget. The widget
nicely handles most editing functions, but there is a unique operation
I want to provide. When the user selects Edit > BLEEP, the app is
supposed to BLEEP the document.
BLEEPing is not something Qt does, I have to implement BLEEP with
native Python code. So when the user says BLEEP it, I must:
1. Use QPlainTextEdit toPlainText() to get the document text as a QString
2. Use QString toUTF8() to get Utf-8 text that Python can use
3. Apply my Python logic to BLEEP the text
4. Use QString fromUtf8() to return to a QString
5. Use QPlainTextEdit fromPlainText() to replace the document with the
BLEEPed contents.
Does this sound right?
Can PyQt do #2 and #4 automagically?
And what are the performance implications when a document might have
one or two megabytes of text?
Thanks for any insights,
Dave C.
    
    
More information about the PyQt
mailing list