PDA

View Full Version : My First Post - How could I do ...



Dalamar
15th February 2006, 00:59
I would like to code a simple telnet client using qt widgets.

I uses qt 3.3 but I think I could switch to 4.1 if it helps.

I thought about using a simple QTextEdit but I need some features I can't find in it...

Features Requested:

1)I would like to color chars both foreground and background in different ways in the same text
2)I would like to color the background of a whole line when it's requested
3)I would like to write blink chars

A Widget that could render these HTML features would be perfect, but i don't know if it exists

How should I do to obtain these features?

Sorry for my bad English,

Dalamar

Cesar
15th February 2006, 09:33
Dear Dalamar! Please, next time be more precise, when choosing the subject :) .
Frankly saying I don't know much about QT3, but in QT4 QTextEdit fits well for feature 1 and 2. As for blinking text... I suppose you should subclass it to implement such a feature.

Dalamar
15th February 2006, 10:11
For the subject, I promise I'll do :)

Ok I try to switch to QT4 and implement the first two features.

I'll surely come back for the "blink" feature... i think it's all about recoding some paint function but It's my first approach to QT I don't know if I'll be able.

Thanks,

Dalamar

michel
15th February 2006, 18:46
Features Requested:

1)I would like to color chars both foreground and background in different ways in the same text
2)I would like to color the background of a whole line when it's requested
3)I would like to write blink chars

A Widget that could render these HTML features would be perfect, but i don't know if it exists


Why would the buffer of a telnet application have parsed HTML in it? Are you making a telnet app or a web browsing app?



I'll surely come back for the "blink" feature... i think it's all about recoding some paint function but It's my first approach to QT I don't know if I'll be able.

No, just add a QTimer, a slot, and a toggle variable in your reimplementation of the widget, make a connect() in the widget constructor between the timer and the widget, then when the timer sends the timeout() signal, check in your slot if the toggle is set to on or off, hide or show the relevant text, set the toggle to the opposite, and restart the timer.

Only two problems I have with this without trying it:

1. Blinking text is annoying and your program will probably take a lot of time to support full terminal emulation, unless you want something like Microsoft's old telnet client (i.e. Notepad with local echo).
2. I think this program would be funny with 80x24 rows of blinking text and one row at the bottom where you are trying to type something really fast over a slow connection to the remote computer. :)

Dalamar
15th February 2006, 23:04
I know I'm a Boring Newbie...
I'm always on QT3 , I have a little problem with signals and slots...

I have two functions emitting the same signal

The functions are called alternately:

func1
func2
func1
func2

But I get a result like it was:

func1
func1
func2
func2

They are asynchronous? Could I sync them?

michel
15th February 2006, 23:51
I know I'm a Boring Newbie...
I'm always on QT3 , I have a little problem with signals and slots...

I have two functions emitting the same signal

The functions are called alternately:

func1
func2
func1
func2

But I get a result like it was:

func1
func1
func2
func2

They are asynchronous? Could I sync them?

What does the code look like? I mean, what exactly are the two functions doing that make the order they are called so important, so one can determine if it could be done another way? Also, check out the manual's entry for QObject::disconnect() and see if this is of any use.

Dalamar
16th February 2006, 00:11
Stop Thinking About THAT! I probably wrote wrong code!

However the order was a great problem cause...

func1 manages escape codes
func2 manages normal output

Now func1 display only some extra info but in future it have to change the color of the text that will follow, the order is very important.

michel
16th February 2006, 14:19
I understand if it is embarrassing to show your code to other people because you think they will laugh at it. But remember, you will never see any of us. So what do you care if someone laughs? Someone who makes fun of others' abilities instead of being polite is probably not wanting to be helpful anyway, so you might as well ignore everything they say.

Or do you not want to show it for licensing reasons? Then I hope you are not using Qt Free or you will have some bad news in the future from the Trolltech Legal Department :D :D :D

Either way, it is hard to guess what someone wants a function to do when they only tell you what they believe it is currently doing. Being able to look at the code, another person can say immediately whether it is even written correctly.