On 18.09.2009, at 15:36, ext Liebe Markus (RtP2/TEF72) wrote: > Hi Eike, Daniel and Bjørn > > Thanks for your replies! They were all very useful to me. > As a quick roundup: The problem was: > I have a signal emitted in the CPPEditor class, to which I want to > connect a slot in my own plugin TasktrackerPlugin and I don't get it. > > Eike wrote: >> You'll probably want to monitor editor creation by the use of the >> corresponding signals of the EditorManager, >> and in case of the created editor being a cpp one, connect to your >> signal. > > Hi Eike. I tried to do this. > The problem for me was that the signal editorCreated(Core::IEditor*, > const Qstring &fileName) passes just an Interface to the Editor. > In my plugin I was able to connect to the editorCreated(...) signal. > But in the corresponding slot I then had a pointer to a > Core::Ieditor. I found no way to get a pointer to a CPPEditor or a > BaseTextEditor. And I found no way to somehow get such a pointer via > the interface.
IEditor *editor = ...; CPPEditor *cppeditor = qobject_cast<CPPEditor *>(editor->widget()); if (cppeditor) { connect(....); } I agree that it's not obvious :) And it isn't elegant either. > So I had no possibility to connect to a signal which is emitted from > the CPPEditor class or the BaseTextEditor class. > As a consequence I dropped this idea. Perhaps there is a way to > achieve this, but I did not get it. > > Bjørn wrote: >> I recently moved the Ctrl+Click navigation down into the >> BaseTextEditor. >> Hooking into that requires reimplementing the virtual methods >> BaseTextEditor::findLinkAt and BaseTextEditor::openLink. The >> CPPEditor >> has implementations of those that you should be able to extend. > > I did so. This worked for me. > > At the moment I have a solution for my problem. I used > addAutoReleasedObject(...) in my plugin to add an Interface to the > tasktrackerplugin. > In the cppeditor I get a pointer to this addedObject and I am able > to call a function of this object to load the specified tasktracker > id in the tasktrackermodes webview. > > It is certainly not the most elegant way to do that I am afraid. But > for the moment it works. Now I will try to get a deeper look into > the creator sources to get an understanding of how to do it better. > > The best case for me would be If it would be possible to implement > everything in the plugin. Without the need to touch the CPPEditor at > all. > > I am looking forward to the Developer days. Perhaps I will chat with > a few of you on this topic. Don't hesitate to chat with us on irc, #qt-creator on freenode :) ++ Eike _______________________________________________ Qt-creator mailing list Qt-creator@trolltech.com http://lists.trolltech.com/mailman/listinfo/qt-creator