• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KParts

  • kparts
factory.cpp
Go to the documentation of this file.
1/* This file is part of the KDE project
2 Copyright (C) 1999 Simon Hausmann <hausmann@kde.org>
3 (C) 1999 David Faure <faure@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "factory.h"
22#include "part.h"
23
24#include <QtGui/QWidget>
25
26#include <kpluginloader.h>
27#include <klibrary.h>
28#include <klocale.h>
29#include <kglobal.h>
30#include <kcomponentdata.h>
31#include <assert.h>
32
33using namespace KParts;
34
35Factory::Factory( QObject *parent )
36: KLibFactory( 0, 0, parent )
37{
38}
39
40Factory::~Factory()
41{
42}
43
44Part *Factory::createPart( QWidget *parentWidget, QObject *parent, const char *classname, const QStringList &args )
45{
46 Part* part = createPartObject( parentWidget, parent, classname, args );
47 if ( part )
48 emit objectCreated( part );
49 return part;
50}
51
52KComponentData Factory::partComponentData()
53{
54 return KComponentData();
55}
56
57KComponentData Factory::partComponentDataFromLibrary( const QString &libraryName )
58{
59 KPluginLoader loader( libraryName );
60
61 KLibFactory *factory = loader.factory();
62 if ( !factory )
63 return KComponentData();
64 KParts::Factory *pfactory = dynamic_cast<KParts::Factory *>( factory );
65 if ( !pfactory )
66 return KComponentData();
67 return pfactory->partComponentData();
68}
69
70Part *Factory::createPartObject( QWidget *, QObject *, const char *, const QStringList & )
71{
72 return 0;
73}
74
75QObject *Factory::createObject( QObject *parent, const char *classname, const QStringList &args )
76{
77 assert( !parent || parent->isWidgetType() );
78 return createPart( static_cast<QWidget *>( parent ), parent, classname, args );
79}
80
81#include "factory.moc"
KComponentData
KParts::Factory
A generic factory object to create a Part.
Definition: factory.h:43
KParts::Factory::createObject
virtual QObject * createObject(QObject *parent=0, const char *classname="QObject", const QStringList &args=QStringList())
Reimplemented from KLibFactory.
Definition: factory.cpp:75
KParts::Factory::Factory
Factory(QObject *parent=0)
Definition: factory.cpp:35
KParts::Factory::partComponentDataFromLibrary
static KComponentData partComponentDataFromLibrary(const QString &libraryName)
A convenience method for partComponentData that takes care of retrieving the factory for a given libr...
Definition: factory.cpp:57
KParts::Factory::createPartObject
virtual Part * createPartObject(QWidget *parentWidget=0, QObject *parent=0, const char *classname="KParts::Part", const QStringList &args=QStringList())=0
Reimplement this method in your implementation to create the Part.
Definition: factory.cpp:70
KParts::Factory::~Factory
virtual ~Factory()
Definition: factory.cpp:40
KParts::Factory::createPart
Part * createPart(QWidget *parentWidget=0, QObject *parent=0, const char *classname="KParts::Part", const QStringList &args=QStringList())
Creates a part.
Definition: factory.cpp:44
KParts::Factory::partComponentData
virtual KComponentData partComponentData()
If you have a part contained in a shared library you might want to query for meta-information like th...
Definition: factory.cpp:52
KParts::Part
Base class for parts.
Definition: part.h:216
KPluginFactory
KPluginFactory::objectCreated
void objectCreated(QObject *object)
KPluginLoader
KPluginLoader::factory
KPluginFactory * factory()
QObject
QWidget
factory.h
kcomponentdata.h
kglobal.h
klibrary.h
klocale.h
kpluginloader.h
KParts
part.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KParts

Skip menu "KParts"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal