kate part

Simon Hausmann hausmann at kde.org
Wed Dec 19 12:59:02 UTC 2001


On Tue, Dec 18, 2001 at 11:48:58PM +0100, Sandy Meier wrote:
> But I have a question using the kate part through the KTextEditor interface. 
> for instance:
> 
> // meta
> KTrader::OfferList offers = KTrader::self()->query( "KTextEditor/Document" );
> KService::Ptr service = *offers.begin();
> KLibFactory *factory = KLibLoader::self()->factory( service->library() );
> 
> // now a doc
> KTextEditor::Document* doc = static_cast<KTextEditor::Document 
> *>(factory->create( this, 0, "KTextEditor::Document" ) );

A slightly nicer looking version of these five lines would be

KTextEditor::Document *doc =
    KParts::ComponentFactory::createInstanceFromQuery<KTextEditor::Document>
    ( "KTextEditor/Document", QString::null, parent, name );

:-)

Simon




More information about the KDevelop-devel mailing list