This forum has been archived. All content is frozen. Please use KDE Discuss instead.

KPart in QML interface?

Tags: None
(comma "," separated)
oriol
Registered Member
Posts
10
Karma
0
OS

KPart in QML interface?

Wed Apr 25, 2012 4:22 pm
Hi,

I'm *very* new to programming so please forgive me if I say anything here that doesn't make any sense or is just plain stupid. I'm trying to write a KDE application with a QML interface, and within that interface I would like to embed a KPart. I have tried a million things, and the closest I have gotten to making it work is by putting the KPart in a QDeclarativeItem, and then making it available as a QML type through qmlRegisterType. In the QDeclarativeItem, I wrap the KPart with a QGraphicsProxyWidget. With this, I do see the KPart in my QML interface, but it appears only in a small rectangle (much smaller than the rectangle within which I placed it) and it is a complete mess in terms of menus, etc.

Am I trying to do something that just cannot be done? Or is there a way to do this that I'm missing?

Any help would be much appreciated!

Best,
Oriol
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: KPart in QML interface?

Thu Apr 26, 2012 8:43 am
I fear this will be difficult.
For the sizing issues, you need to setup layouts, to ensure the QGraphicsWidget fills the available space in the QDeclarativeItem.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
oriol
Registered Member
Posts
10
Karma
0
OS

Re: KPart in QML interface?

Fri Apr 27, 2012 3:38 pm
Thanks for your help, Ben. Layouts improved things a little since now I can see the whole width of the KPart, but I am still only seeing its very top. I wonder if the problem is that KParts are not QWidgets, and so when I wrap the KPart with a QGrapicsProxyWidget there's bound to be problems. I don't know how else to do this though. I have been playing around with this for days and I am getting nowhere. My coding skills are obviously not good enough to solve this, so I guess I'll build the GUI with QWidgets and I'll come back to this when I understand how all this works better (and maybe QtQuick 2.x will make this easier). Thanks anyway!
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS

Re: KPart in QML interface?

Sat Apr 28, 2012 9:17 pm
Make sure to use KXMLGuiWindow if you want to allow KParts to be used, as it allows for menus and toolbars to be merged in.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
User avatar
mjobin
Registered Member
Posts
40
Karma
0
OS

Re: KPart in QML interface?

Tue Sep 08, 2015 1:12 pm
I am looking for a working example in QML/QtQuick that embed a KPart

ideally, the konsolepart

thanks
User avatar
mjobin
Registered Member
Posts
40
Karma
0
OS

Re: KPart in QML interface?

Fri Sep 23, 2016 2:14 pm
answered all my questions...

example in QML embedding konsolepart

https://github.com/Swordfish90/cool-retro-term

The QML terminal widget https://github.com/Swordfish90/qmltermwidget

And finally, (drum rolling)

a yakuake fork, that tries to be very much like Konsole, but with REAL SPLIT PANES !!!

Final name has to be decided, and a new repo on github will be created once we are settled on a good name
please try it, and names suggestions are welcome

https://bitbucket.org/somekool/kde-start/


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot]