Hi, On Saturday, 10. December 2011, Mihai Cosmin wrote: > Hello, > > I'm Cosmin Mihai, I'm working on xml plugin and i have some > difficulties.I need to use KTextEditor::SmartCursorNotifier class, for > that i need a KTextEditor::SmartCursor, but i can't obtain it.I was > looking in the API and it says to do that: > > KTextEditor::SearchInterface* smart = > qobject_cast( yourDocument ); > if ( smart ) { > KTextEditor::SmartCursor* cursor = smart->newSmartCursor(); > } > Before if, the smart variable is always null, so cursor is never even > declared. > The final goal is to connect a signal that is emitted when a character is > deleted. All Smart* classes were removed, hence it does not work. Use the MovingInterface, the MovingRanges and MovingCursors instead: http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/classKTextEditor_1_1MovingInterface.html http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/classKTextEditor_1_1MovingCursor.html http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/classKTextEditor_1_1MovingRange.html > The second problem is that i can't find the signal that is emitted when > KTextEditor::View begins. The KTextEditor::Document emits the signal KTextEditor::Document::viewCreated(KTextEditor::Document *document, KTextEditor::View *view) see: http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/classKTextEditor_1_1Document.html#a40451055d67e3775b5975741c6e0662f > Until now i used > QList lst = > Kate::application()->documentManager()->documents(); > kd=lst[0]; Well, lst.size() may be 0, so accessing the first element with [0] without checking possibly crashes... > But it works only for the first window.I need KTextEditor::View signal to > know when is ready to be used ,because it has a method > (KTextEditor::View::document()) that retrieves the current window, > otherwise it crashes. > > Any ideas? There is a signal from KTextEditor::Editor called void documentCreated(KTextEditor::Editor *editor, KTextEditor::Document *document) See: http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/classKTextEditor_1_1Editor.html Greetings, Dominik _______________________________________________ KWrite-Devel mailing list KWrite-Devel@kde.org https://mail.kde.org/mailman/listinfo/kwrite-devel