Some Qt Code

Miscellaneous Forums/Linux Discussion/Some Qt Code

Here is some example code than will run from the tests folder.

Try removing the framework and uncommenting the win32maxgui you will see the differences.

Strict 

Framework bah.qtmaxgui
'Import	 brl.win32maxgui

Import		brl.d3d7max2d

Local window:TGadget
Local panel:TGadget
Local panel2:TGadget
Local group:TGadget

Global image:TPixmap
Global canvas:TGadget

window=CreateWindow("My Window",140, 140, 320, 240)
AddHook EmitEventHook, MyHook

' create a purple panel that occupies entire window client area
panel=CreatePanel(0,0,ClientWidth(window),ClientHeight(window),window,PANEL_ACTIVE|PANEL_BORDER)
SetGadgetLayout panel,1,1,1,1
SetPanelColor panel,100,0,200

panel2=CreatePanel(10,10,114,87,panel,0)

image:TPixmap = LoadPixmapPNG( "bmax120.png" )
Assert image, "Unable to load image"
SetPanelPixmap(panel2,image)

canvas = CreateCanvas(134,10,114,87,panel)

While True
	WaitEvent 
	Print CurrentEvent.ToString()
	Select EventID()
		Case EVENT_WINDOWCLOSE
			End
	End Select
Wend

Function MyHook:Object( iId:Int, tData:Object, tContext:Object )

	Local event:TEvent=TEvent(tData)
	If event = Null Return Null

	Select event.ID

		Case EVENT_GADGETPAINT

			If event.source = canvas
				SetGraphics CanvasGraphics(canvas)
				SetClsColor(Rnd(255),Rnd(255),Rnd(255))
				Cls
				Flip
			EndIf

	EndSelect

	Return tData

End Function