[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Interacting with KatePart from code
From: Milian Wolff <mail () milianw ! de>
Date: 2013-05-29 20:42:09
Message-ID: 2407505.TDoBbpL4yx () minime
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
On Wednesday 29 May 2013 21:38:03 Adrián Chaves Fernández wrote:
> Hi,
>
> I want to start an application with a text editor that provides a specific
> syntax highlighting, as the application is only going to support a specific
> type of files (MediaWiki). Then I plan to build some features
> (auto-complete, etc.) on top of it.
>
> Not to reinvent the wheel, I wanted to reuse Kate's text edition widget.
> I've actually been working on improving the MediaWiki syntax highlighting
> support in Kate, so reusing that work for my app would be ideal.
>
> So I found myself copying and pasting the code in
> http://techbase.kde.org/Development/Tutorials/Using_KParts
>
> Now I have a working KatePart. But I have no idea whatsoever about
> interacting with it from code (such as getting an instance of
> KateDocument). Any recommendation that puts me in the right direction to
> set the KatePart syntax highlighting from code?
Look at KTextEditor and its apidox. If in doubt grep for it in KDevplatform to
see how its being used.
> Also, I want to manually define the context-menu items and any other actions
> in the interface, so I'm not calling createGUI(m_part). Most KatePart
> actions I don't want to provide, so is KatePart the right choice for me
> nonetheless? Or is there another way (without kparts) of reusing Kate's
> text edition widget that fits my use case better?
You can use KTextEditor::Editor::createDocument (e.g. from
KTextEditor::Factory) and then create a view for that document. Regarding
filtering of context menu items, I'm not sure anymore whether there is
anything being added automatically. If so and you cannot find a way to
circumvent that, feel free to contact us on kwrite-devel and we'll find a way
to solve this.
Cheers
--
Milian Wolff
mail@milianw.de
http://milianw.de
["signature.asc" (application/pgp-signature)]
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic