Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 7

Qt-interest Archive, July 2003
XInitThreads() and key press under an XIM client(Chinput or xcin)?


Message 1 in thread

Hi!

I have the following problem:
When I use an XIM in the X environment(I tested Chinput and xcin under GBK and Big5 encoding),and setted 
XMODIFIERS=@im=Chinput(or XMODIFIERS=@im=xcin),
In my multithreaded app I call XInitThreads() first and then the app hangs
when I press any key. Without that call it works.

I made a short example program .In file main.cpp I call XInitThreads at the first line .
The cursor in the edit line will stop blinking when you press any key and then you can do nothing.

I tested it on RedHat Linux 9, Qt-X11-3.1 and XFree86 4.3

Regards,
Sun Gang.


Message 2 in thread

Hi,

> I have the following problem:
> When I use an XIM in the X environment(I tested Chinput and xcin under GBK and Big5 encoding),and setted 
> XMODIFIERS=@im=Chinput(or XMODIFIERS=@im=xcin),
> In my multithreaded app I call XInitThreads() first and then the app hangs
> when I press any key. Without that call it works.

Why do you call XInitThreads()? Are you aware of the limitations related 
to threads in Qt?

> I made a short example program .In file main.cpp I call XInitThreads at the first line .
> The cursor in the edit line will stop blinking when you press any key and then you can do nothing.
> 
> I tested it on RedHat Linux 9, Qt-X11-3.1 and XFree86 4.3

--
 [ signature omitted ] 

Message 3 in thread


<<< text/html: EXCLUDED >>>


Message 4 in thread

Hi,

> Base is class declared by myself inherited from QDialog.
> 
> I called pthread_create() in my Base's member function to create a new thread,
> in the new thread, it access the Base's GUI(redraw some UI item).
> 
> If without calling XInitThreads in the main(),there will be some faults while calling thread function.
> 
> 
>>See http://doc.trolltech.com/3.1/threads.html
> 
> 
> I have read the document . I call libpthread instead of QT thread class.

What the document says is true whether you use QThread or POSIX threads. 
QThread is only a wrapper around POSIX threads.

You can't call GUI functions  from many threads.

--
 [ signature omitted ]