PDA

View Full Version : entering text through user interaction in QTextEdit



sar_van81
1st December 2006, 10:22
hi....

i had to write two application wherein in one application , i'l have pushbutons. and in another application i'l have a textbox.i mapped a letter to each pushbutton.i.e when user clicks a pushbutton, i'l signal a function which prints out the corresponding letter. no my problem is that i need to divert the letters to the textbox in another application...

hope i'm not confusing..

can anyone provide me solutions/suggestions as to how to do this...? i don't want the complete code. i jst want how enter a text in the textbox created using QTextEdit.
thanks in advance...

saravanan..............

momesana
1st December 2006, 10:58
If you have two actually independent Qt-Applications that you want to be able to communicate with each other, you best use the Qt-DBus facilities to achieve this interprocess communication.
http://doc.trolltech.com/4.2/intro-to-dbus.html
The corresponding classes were introduced with Qt-4.2 and are not available in earliere qt-releases. If your application is to be deployed in kde-3*, you can also use KDE's dcop facilities that however will be obsolete in KDE-4 in favour of a crossplattform dbus solution.

If this is too much trouble for you, you can also use a file to write to from one application and read out the content of the file via the other application within given intervals or by using the QFileSystemWatcher class that was also introduced in Qt-4.2. This way, everytime you write something to the file, the other application is notified and can then start reading out the letter,text etc.

Good luck

sar_van81
1st December 2006, 14:04
hi...

currently we are working with qt-embedded-free-3.3.5. is this possible with this package...? or should i migrate to qt-4.x....?

jacek
1st December 2006, 14:21
currently we are working with qt-embedded-free-3.3.5. is this possible with this package...? or should i migrate to qt-4.x....?
No, there are other IPC mechanisms you can use. As for the keys themselves, you can try to simulate them by posting QKeyEvents to a widget that currently has the focus.

wysota
1st December 2006, 14:42
I think the problem is that the other widget is in a different application, so I doubt it's possible using Qt events only unless Qt/Embedded has such an ability.

jacek
1st December 2006, 16:46
I think the problem is that the other widget is in a different application
Yes and when that other application receives a character through some IPC mechanism, it can post an event to pass it to the right widget.

wysota
1st December 2006, 22:41
Yes and when that other application receives a character through some IPC mechanism, it can post an event to pass it to the right widget.

Ah, I see :) I misunderstood you.