[Qt-creator] Send a message to the general message panel

David Schulz david.schulz at digia.com
Tue May 21 08:41:46 CEST 2013


Am 5/17/2013 11:45 PM, schrieb Thomas Meyer:
> Hi,
> how can I send a simple string (QString) from a plugin to the 'General
> Messages' panel (or pane)
> and how to the TextEditor (an opened text file)?

Hi,

you can use EditorManager::currentEditor() to get the editor.
You receive an IEditor object, which you have to cast to ITextEditor.
ITextEditor define the function insert(const QString& string)....

sample code:

if(IEditor*editor=EditorManager::currentEditor()){
if(TextEditor::ITextEditor*textEditor=qobject_cast<TextEditor::ITextEditor*>(editor))
textEditor->insert(QString("Helloworld"));
}

Don't forget to add the TextEditor Plugin as a dependencie to your plugin :)

BR,
David

> Where can I find some documentation about the 'communication' (sending
> or receiving strings etc.)
> between plugins and the different panes (panels?) and the TextEditor?
>
> Example:
> I have build a simple plugin, which is a dialog with a button 'send
> text' and should send
> 'Hello world' to an opened text file. For 'debugging' I want to send
> 'send text pressed'
> to the 'General Messages' pane.
>
> Thanks,
>       Thomas
>
>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qt-creator

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20130520/f706c6a1/attachment.html>


More information about the Qt-creator mailing list