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

List:       kde-devel
Subject:    Re: Docs for using KParts in application
From:       David Faure <faure () kde ! org>
Date:       2006-01-16 12:29:22
Message-ID: 200601161329.22807.faure () kde ! org
[Download RAW message or body]

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]

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<KParts::ReadOnlyPart>( \
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 <<


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

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