On 16/01/06, David Faure wrote: > On Sunday 15 January 2006 09:12, Christoffer Brodd-Reijer wrote: > > Hi, > > > > I am trying to find documentation in some form on how I can use KParts > > in my C++ application. The documentation out there found by Google is > > far from complete, since it only covers how to write your own KParts. I > > am looking for how I can add KParts to my application to make it more > > integrated with KDE and easier to write. > > > > By the way, I heard something about finding out a users preferred KPart > > via KIO or something. I would like to know more about that. > > > > So if anyone can give me some directions it would be great. > > IIRC my tutorial on > http://www-106.ibm.com/developerworks/linux/edu/l-dw-linuxkp1-i.html > http://www-106.ibm.com/developerworks/linux/edu/l-dw-linuxkp2-i.html > had info about that. [registration needed] > Nice tutorials. Is there a way to get the A4 PDF version for KParts Tut 1. It seems it is not available. Both PDF links are dead. Paulo Matos > But otherwise, just look up the docs for KParts::ComponentFactory. > Hmm, not in the API docs since it seems we don't generate docs for templates?? > > The easiest way: > * You can use this method to create a generic viewer - that can display any > * kind of file, provided that there is a ReadOnlyPart installed for it - in 5 lines: > * \code > * // Given the following: KURL url, QWidget* parentWidget and QObject* parentObject. > * QString mimetype = KMimeType::findByURL( url )->name(); > * KParts::ReadOnlyPart* part = KParts::ComponentFactory::createPartInstanceFromQuery( mimetype, QString::null, parentWidget, 0, parentO > bject, 0 ); > * if ( part ) { > * part->openURL( url ); > * part->widget()->show(); // also insert the widget into a layout, or simply use a QVBox as parentWidget > * } > > > -- > David Faure, faure@kde.org, sponsored by Trolltech to work on KDE, > Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org). > > > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe << > -- Paulo Jorge Matos - pocm at sat inesc-id pt Web: http://sat.inesc-id.pt/~pocm Computer and Software Engineering INESC-ID - SAT Group >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<