[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kwrite-devel
Subject:    Re: Kate XMLEdit plugin difficulties
From:       Dominik Haumann <dhdev () gmx ! de>
Date:       2011-12-10 18:10:50
Message-ID: 201112101910.50452.dhdev () gmx ! de
[Download RAW message or body]

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<KTextEditor::SmartInterface*>( 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<KTextEditor::Document*> 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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic