Hi Jason, On Sunday 16 November 2014 04:20:28 Jason Alan Smith wrote: > Hello everyone, > > I am developing an application that helps users and developers manage > a variety of database servers, and I would like to use a KTextEditor (or > Kate) as my text editing widget as it has line numbering and syntax > highlighting capabilities built in. > > I found a tutorial that shows how to use KTextEditor but as the > central widget of the main window. I have my own session widget that > contains for now a KRichTextEdit widget and a QTableView widget. I want > to replace the KRichTextEdit with a KTextEditor to gain the Kate > functionality. > > I am having difficulties figuring out how to accomplish this. I've > looked at the source code for various applications, including Kile and > Quanta, and have even started looking at KDevPlatform. I'm sure I could > figure this out with enough time from one or more of these applications, > but I was wondering if anyone could point me to a tutorial or a small, > simple application, or a minimal code snippet or example that > demonstrates how to achieve this. Thank you for your time.
Is this on KDE4 or KF5 ? In KDE4, you first have to do something like this: KTextEditor::Editor *editor = KTextEditor::EditorChooser::editor(); if (!editor) { // the KTextEditor implementaiton was not found } KTextEditor::Document * document = editor->createDocument(parentObject); KTextEditor::View * view = editor->createView(parentWidget); view = document->createView(this); Resources: - http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/kte_howto.html - http://api.kde.org/4.x-api/kdelibs-apidocs/interfaces/ktexteditor/html/index.html- If you want the actions to also be visible, you also need to add the XML gui client to the XML factory. But from what you write, you don't want this. In KF5, it's like this: KTextEditor::Document * document = KTextEditor::Editor::instance()->createDocument(parentObject); KTextEditor::View * view = editor->createView(parentWidget); view = document->createView(this); Resources: - http://api.kde.org/frameworks-api/frameworks5-apidocs/ktexteditor/html/index.html Hope that helps, Dominik >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<