[Konsole-devel] question about KDE4 and konsole parts - succeeded getting a konsole part
Giacomo
delleceste at gmail.com
Mon Aug 27 13:57:51 UTC 2007
Hi!
I succeeded in obtaining a konsole part in my application!
I just created a KApplication instead of a QApplication and
inherited from KParts::MainWindow in the constructor of the
main window!
The only problem now is to start my program:
terminal_interface->startProgram() leaves my console with
the prompt in my working directory but does not execute
the program indicated as argument in startProgram()
Thanks in advance for any other hint (if what i've done is enough and
if i am right with calling startProgram() ) and for the advice given.
Regards, Giacomo
2007/8/27, Giacomo <delleceste at gmail.com>:
> Good morning and thank you for your answer.
>
> I found the kate plugin example, and i applied it to my code.
>
> The problem is that i am missing something probably...
>
> In fact, my application at startup says:
>
> Fatal error: you need to have a KComponentData object before
> you do anything that requires it! Examples of this are config
> objects, standard directories or translations.
>
> My main window class is declared like this:
>
> class IQFIREmainwin : public KParts::MainWindow
> { ... };
>
> and the constructor does:
>
> IQFIREmainwin::IQFIREmainwin(QWidget* p, int argc, char **argv) :
> KParts::MainWindow()
> {
> ui.setupUi(this);
> CreateSystemTray();
> ...
> /* ui.pageConsole is a page of a QT Stacked widget */
> QGridLayout *consolelo = new QGridLayout(ui.pageConsole);
>
> IQFWidgetKonsole* iqfconsole = new IQFWidgetKonsole(ui.pageConsole);
> consolelo->addWidget(iqfconsole, 0, 0);
>
> /* IQFWidgetKonsole is the widget that contains the part */
>
> ui.stackedWidgetMain->setCurrentWidget(ui.pageConsole);
>
> }
>
> class IQFWidgetKonsole : public QWidget
> {
> public:
> IQFWidgetKonsole(QWidget *parent);
> ~IQFWidgetKonsole();
> };
>
> IQFWidgetKonsole::IQFWidgetKonsole(QWidget *parent)
> {
> KLibFactory* factory = KLibLoader::self()->factory( "libkonsolepart" );
> qDebug() << "IQFWidgetKonsole() : constructor";
> if ( factory == 0L )
> {
> // inform the user that he should install konsole..
> QMessageBox::information(this, "Information",
> "You need to install konsole!");
>
> return;
> }
> KParts::ReadOnlyPart *part = static_cast<KParts::ReadOnlyPart *>
> (factory->create(this, "KParts::ReadOnlyPart"));
>
> // start the terminal
> qobject_cast<TerminalInterface*>(part)->showShellInDir( QString() );
>
>
>
> }
>
> i am missing something substantial...
> but i am new in kde programming and, most of all, i did not find some
> startup tutorial...
>
> Thank you for any hint..
>
> GIacomo
>
>
>
> 2007/8/26, Giacomo <delleceste at gmail.com>:
> > ---------- Forwarded message ----------
> > From: Robert Knight <robertknight at gmail.com>
> > Date: 25-ago-2007 19.06
> > Subject: Re: [Konsole-devel] question about KDE4 and konsole parts
> > To: konsole-devel at kde.org
> >
> >
> > > but since QT4 do not provide an efficient class to
> > > print out messages as konsole does (QTextEdit is very slow)
> > > i must integrate my app with a konsole.
> >
> > QTextEdit has an optimised mode for logging which can be enabled by
> > calling textEdit->setTextFormat( Qt::LogText )
> >
> > Yes, but i need to include QT3 support (the option is no more available in QT4)
> > anyway i tried it...
> >
> > The comparison anyway is:
> > 20% - 50% CPU usage with QTextEdit
> > 0.7% - 2% CPU usage inside Konsole (pure C command line application)
> >
> > .....
> >
> > Thanks anyway.
> > Tomorrow i will have a look at kate part and let you know!
> >
> > Thank you again!!
> >
> >
> >
> >
> > Regards,
> > Robert.
> >
> > On 24/08/07, Giacomo <delleceste at gmail.com> wrote:
> > > Sorry, I meant kdebase, not kdecore!
> > >
> > > Ok i will have a look at kate's terminal plugin then!
> > >
> > > Thank you very much!
> > >
> > > I usually program inside QT4 environment, but never
> > > wrote code integrating with kde.. but since QT4 do not
> > > provide an efficient class to print out messages as konsole does
> > > (QTextEdit is very slow) i must integrate my app with a konsole.
> > >
> > > Thanks again, giacomo
> > >
> > > Giacomo
> > >
> > > 2007/8/24, Robert Knight <robertknight at gmail.com>:
> > > > Hello Giacomo,
> > > >
> > > > > I have installed kdelibs (of KDE4), kdepimlibs and kdecore.
> > > >
> > > > I'm not sure what you mean by "kdecore", that is a library which is
> > > > part of kdelibs. You need kdebase installed as well.
> > > >
> > > > I think the easiest option would be to look at the code for Kate's
> > > > terminal plugin, which can be found in:
> > > >
> > > > trunk/KDE/kdesdk/kate/plugins/konsole/
> > > >
> > > > Specifically, the KateConsole::loadConsoleIfNeeded() code in
> > > kateconsole.cpp
> > > >
> > > > Regards,
> > > > Robert.
> > > >
> > > >
> > > >
> > > > On 24/08/07, Giacomo <delleceste at gmail.com> wrote:
> > > > > Good morning.
> > > > >
> > > > > I would like to embed a Konsole in my QT4 application.
> > > > >
> > > > > More precisely, i would like to have a Konsole as a child of a QWidget
> > > > > inside my QT application (QMainWindow).
> > > > >
> > > > > I have installed kdelibs (of KDE4), kdepimlibs and kdecore.
> > > > >
> > > > > Can anyone tell me how to do this in QT4?
> > > > >
> > > > > The example in kde_terminal_interface.h does not work in QT-KDE4.
> > > > >
> > > > > Thanks for any suggestion.
> > > > >
> > > > > Giacomo Strangolino, Italy.
> > > > >
> > > > > --
> > > > > Giacomo S.
> > > > > http://www.giacomos.it
> > > > >
> > > > > - - - - - - - - - - - - - - - - - - - - - -
> > > > >
> > > > > IPFIREwall (http://www.giacomos.it/ipfire) viene presentato
> > > > > all'Universita` degli Studi di Udine, il 28 ottobre, in occasione del
> > > > > Linux Day 2006:
> > > > > http://iglu.cc.uniud.it/linuxday
> > > > >
> > > > > - - - - - - - - - - - - - - - - - - - - - -
> > > > >
> > > > > . '' `.
> > > > > : :' :
> > > > > `. ` '
> > > > > `- Debian GNU/Linux -- The power of freedom
> > > > > http://www.debian.org
> > > > > _______________________________________________
> > > > > konsole-devel mailing list
> > > > > konsole-devel at kde.org
> > > > > https://mail.kde.org/mailman/listinfo/konsole-devel
> > > > >
> > > > _______________________________________________
> > > > konsole-devel mailing list
> > > > konsole-devel at kde.org
> > > > https://mail.kde.org/mailman/listinfo/konsole-devel
> > > >
> > >
> > >
> > > --
> > > Giacomo S.
> > > http://www.giacomos.it
> > >
> > > - - - - - - - - - - - - - - - - - - - - - -
> > >
> > > IPFIREwall (http://www.giacomos.it/ipfire) viene presentato
> > > all'Universita` degli Studi di Udine, il 28 ottobre, in occasione del
> > > Linux Day 2006:
> > > http://iglu.cc.uniud.it/linuxday
> > >
> > > - - - - - - - - - - - - - - - - - - - - - -
> > >
> > > . '' `.
> > > : :' :
> > > `. ` '
> > > `- Debian GNU/Linux -- The power of freedom
> > > http://www.debian.org
> > > _______________________________________________
> > > konsole-devel mailing list
> > > konsole-devel at kde.org
> > > https://mail.kde.org/mailman/listinfo/konsole-devel
> > >
> > _______________________________________________
> > konsole-devel mailing list
> > konsole-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/konsole-devel
> >
> >
> > --
> > Giacomo S.
> > http://www.giacomos.it
> >
> > - - - - - - - - - - - - - - - - - - - - - -
> >
> > IPFIREwall (http://www.giacomos.it/ipfire) viene presentato
> > all'Universita` degli Studi di Udine, il 28 ottobre, in occasione del
> > Linux Day 2006:
> > http://iglu.cc.uniud.it/linuxday
> >
> > - - - - - - - - - - - - - - - - - - - - - -
> >
> > . '' `.
> > : :' :
> > `. ` '
> > `- Debian GNU/Linux -- The power of freedom
> > http://www.debian.org
> >
>
>
> --
> Giacomo S.
> http://www.giacomos.it
>
> - - - - - - - - - - - - - - - - - - - - - -
>
> IPFIREwall (http://www.giacomos.it/ipfire) viene presentato
> all'Universita` degli Studi di Udine, il 28 ottobre, in occasione del
> Linux Day 2006:
> http://iglu.cc.uniud.it/linuxday
>
> - - - - - - - - - - - - - - - - - - - - - -
>
> . '' `.
> : :' :
> `. ` '
> `- Debian GNU/Linux -- The power of freedom
> http://www.debian.org
>
--
Giacomo S.
http://www.giacomos.it
- - - - - - - - - - - - - - - - - - - - - -
IPFIREwall (http://www.giacomos.it/ipfire) viene presentato
all'Universita` degli Studi di Udine, il 28 ottobre, in occasione del
Linux Day 2006:
http://iglu.cc.uniud.it/linuxday
- - - - - - - - - - - - - - - - - - - - - -
. '' `.
: :' :
`. ` '
`- Debian GNU/Linux -- The power of freedom
http://www.debian.org
More information about the konsole-devel
mailing list