[Qt-creator] Signals from EditorManager

Eike Ziller Eike.Ziller at qt.io
Tue Mar 17 13:13:47 CET 2020



> On Mar 17, 2020, at 12:47, Vidhya Arun <svidhyapria at gmail.com> wrote:
> 
> Hello All
> 
> Greetings !! 
> 
> I am looking for some signals in EditorManager that notifies me whenever I change a text in the editor. Currently I use ‘currentEditorChanged’ and ‘aboutToSave’. But these get emitted only when I open a new document in editor or save the document after changing the text.
> 
> I also tried ‘documentStateChanged” but this gets called only for the very first change of text after save. 
> 
> Are there any signals that can be handled for each text change without saving it ? My requirement is am trying to update the ASCII content in my output pane whenever there is a change in the source editor. 

This is not forwarded by the EditorManager. You need to e.g. connect (and disconnect) to the editor’s IDocument::contentsChanged() signal directly. Or if you are interested about more details on the change, you’ll need to go further down to TextEditorWidget (for editors that use that).
All the while note that multiple IEditors can work on the same IDocument (or QTextDocument, if the editor is a text editor), e.g. when splitting the view.

Br, Eike

-- 
Eike Ziller
Principal Software Engineer

The Qt Company GmbH
Erich-Thilo-Straße 10
D-12489 Berlin
eike.ziller at qt.io
http://qt.io
Geschäftsführer: Mika Pälsi,
Juha Varelius, Mika Harjuaho
Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B



More information about the Qt-creator mailing list