This sample is from my personal library:

#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()", {|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


Using QEventLoop, i can have 'n' windows, each window with your own event loop.


Regards,
Marcos Gambeta

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to