[Kde-bindings] How to use KParts::ReadOnlyPart in Java?
Mario Scalas
mario.scalas at libero.it
Wed Jan 19 17:10:01 UTC 2005
Hi all,
I'm trying a direct port (from C++ to Java) of a simple KDE application which
just embeds an OpenSceneGraph component (implemented as a ReadOnlyPart).
In C++ all is done easily, but in Java I'm in troubles when loading the
library through the KLibLoader, since it returns a QObject instead of a
ReadOnlyPart class instance :-|
KLibFactory factory = KLibLoader.self().factory( "libosgviewerpart" );
// 1. Works ok, but I need a ReadOnly part since I need the part's widget
// embedded as my main widget!!
QObject part = factory.create( this, "osgviewer_part",
"KParts::ReadOnlyPart" );
// 2. This fails miserably since create() returns a QObject and java-casting
// to a ReadOnlyPart gives only exceptions!
ReadOnly part = factory.create( this, "osgviewer_part",
"KParts::ReadOnlyPart" );
// Set the main widget and create the GUI ...
setCentralWidget( part.widget() );
createGUI();
If I stand with QObject, then I cannot set the widget: the main window shows,
the part is loaded but what I guess to be the part's widget is just a small
black rectangle sitting on top of the toolbar.
So I guess that this must be accomplished in a different way, but what?
Another thing I noticed is the incomplete generation: I've discovered that
KGlobal class doesn't exist while KStdAction has no method for showToolbar(),
while provides open(), quit(), keyBindings() and configureToolbars().
I'm using kdebindings-3.3.2 packages compiled by hand: could I've get
something wrong? I simply run make (no -jx) and it compiled without a glitch.
If it may matter I'm using Sun JDK 1.5.0.01 and eclipse 3.0.1.
Please tell me if you need more info or have any advise.
Regards
Mario
--
Mario Scalas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20050119/f60896c7/attachment.sig>
More information about the Kde-bindings
mailing list