GOOD JOB - w/some suggestions

Martin Piskernig martin.piskernig at stuwo.at
Wed Jun 30 16:00:30 BST 1999


Am Wed, 30 Jun 1999 schrieben Sie:
> It may seem a bit contradictory but I am an experianced programmer (mid 70's) but never got envolved with C++. I now have three tutorials in hand and am attempting a modest "K" project.
> 
> With my humble introduction out of the way, my question which is probably simple to most of you...
> 
> Can you out put directly to KMainWindow with a mechanizim such as cout or do you always have to encapsulate output into some other window type?
> 
> In my particular case I would like to send text only output in tty fashion.
> 
> For example: suppose a person wanted to show the mouse or joystick  x-y position. Could they (a bit tacky I admit) some how send lines to the base window?
> 
> joystick x=345 y=134
> mouse    x=133 y=34
> joystick x=634 y=235
> mouse    x=160 y=44
> joystick x=346 y=344
> mouse    x=153 y=62
> ...

1. AFAIK you always have to use a widget you can draw text on. You could use a
QMultiLineEdit, a QLineEdit, a QLabel or a QPainter with QPainter::drawText(...)
and so on... 
2. You can also redirect stdout/stderr to a widget, like the output view in
kdevelop. KDevelop is generally a very good idea if you don´t know how to code
something. I always look there as most widgets are somewhere used :-)
3. Something I never tried is to derive your main widget directly from e.g. the
QMultiLineEdit, instead of KTMainWindow. Maybe this doesn´t work but I
think it should.

Martin

PS: A very good introduction to the Qt Library is the book from Kalle Dalheimer.



More information about the KDevelop mailing list