Marcos

Thanks for the explanation.
I know about this facts but note that 
this operates on different widgets in the main 
thread. I am talking about different threads.

Try this :

#include "qt.ch"

Procedure Main ()

    Local oApplication
    Local oWindow
    Local oButton

    oApplication := QApplication():New()

    oWindow := QWidget():New()
    oWindow:Resize(320, 240)
    oWindow:SetWindowTitle("Testing class QEventLoop")
    oWindow:Show()

    oButton := QPushButton():New(oWindow)
    oButton:SetText("OK")
    oButton:Resize(80, 30)
    oButton:Move((320-80)/2, (240-30)/2)
    oButton:Show()
    oButton:Connect("clicked()", hb_threadStart( {|p|NewWindow()} ) )

    oApplication:exec()

Return

Function NewWindow ()

    Local oWindow
    Local oEventLoop
    Local oButton
    Static n := 0

    ++n

    oWindow := QWidget():New()
    oWindow:Resize(320, 240)
    oWindow:SetWindowTitle("Window "+str(n,2))
    oWindow:Show()

    oEventLoop := QEventLoop():New(oWindow)

    oButton := QPushButton():New(oWindow)
    oButton:SetText("OK")
    oButton:Resize(80, 30)
    oButton:Move((320-80)/2, (240-30)/2)
    oButton:Show()
    oButton:Connect("clicked()", 
{|p|qt_qwidget_close(oWindow:pointer),MsgInfo("Closing window 
"+qt_qwidget_windowtitle(oWindow:pointer)),oEventLoop:exit(0)})

    oEventLoop:exec(0)

Return nil

Remember to compile appln with -mt switch.

Regards
Pritpal Bedi


-- 
View this message in context: 
http://www.nabble.com/QT---Multi-threading---A-Limitation-tp23163007p23163740.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to