PDA

View Full Version : Terminal into Qt application



paF4uko
25th January 2009, 23:25
I'm currently working on a project in which I need to have several terminals to display SSH sessions on several distant machines. Until now I was using a normal XTerm to display the sessions, but it's not very ergonomic when the number of machines increases, so I decided to use an integrated terminal in my application main window. So does anyone have an idea how to integrate a terminal into a Qt application? However I'd like to take advantage of Qt's portability, so I don't want to use KDE classes (as I already saw such examples).
Thanks in advance!

wysota
26th January 2009, 01:55
In short there are no portable solutions unless you handle the telnet protocol yourself using plain TCP sockets. On X11 you can try to use XEmbed, on Windows maybe there is some terminal application that has a COM interface, on MacOSX - I have no idea. Other than that - you're on your own or you can try to hack Konsole from KDE to see if you can incorporate its sources into your application. Based on a brief look I see it is using something called "libkpty" which probably implements the terminal protocol, so I'd start with stripping libkdecore dependencies and trying to compile it on WIndows and Mac.

paF4uko
26th January 2009, 02:16
Thanks for the reply. Actually I need to make it work on POSIX systems only independently of whether there's KDE or not. I started looking at Konsole yesterday, but the source code has to be explored in details and I have something like a week to finish this part of the project along with many others. Anyway, I'll try to figure something out and I'll post the solution here for others to use.
Cheers!

P.S: I think I'll consider using XEmbed, "libkpty" being part of the KDE libraries. Thanks again!

wysota
26th January 2009, 08:47
P.S: I think I'll consider using XEmbed,
"xterm -into" is a good place to start. Just remember xterm might not be available on a particular system.


"libkpty" being part of the KDE libraries. Thanks again!

That's why I said you'd have to strip out KDE dependencies for it. They are probably only few calls from kdelibs which you can substitute with pure Qt calls.

paF4uko
27th February 2009, 12:22
Someone already ported the Konsole terminal to pure Qt. The project is available at Sourceforge: http://sourceforge.net/projects/qtermwidget

Have fun! :cool: