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

List:       kde-bindings
Subject:    [Kde-bindings] How to use KParts::ReadOnlyPart in Java?
From:       Mario Scalas <mario.scalas () libero ! it>
Date:       2005-01-19 16:10:42
Message-ID: 200501191710.03966.mario.scalas () libero ! it
[Download RAW message or body]

[Attachment #2 (multipart/signed)]


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

[Attachment #5 (application/pgp-signature)]

_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


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

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