|-Start:
#Let's start.
#first we'll create the main widget.
%widget=$new(widget)
#then the groupbox
%gb=$new(groupbox,%widget)
%gb->$setTitle(Login)
%gb->$setAlignment("Left")
#now we create the labels and lineedits.
%labeluser=$new(label,%gb)
%labeluser->$settext(User: )
%labelpass=$new(label,%gb)
%labelpass->$settext(Pass: )
%inputuser=$new(lineedit,%gb)
%inputpass=$new(lineedit,%gb)
%inputpass->$setechomode("password")
#now lets' layouting the groupbox's element's.
%layoutgb=$new(layout,%gb)
%layoutgb->$setmargin(20)
%layoutgb->$addwidget(%labeluser,0,0)
%layoutgb->$addwidget(%labelpass,1,0)
%layoutgb->$addwidget(%inputuser,0,1)
%layoutgb->$addwidget(%inputpass,1,1)
# now we create a fake widget and managing the two buttons layout.
%fakewidget=$new(widget,%widget)
%layoutbtn=$new(layout,%fakewidget)
%btnok=$new(button,%fakewidget)
%btnok->$settext("OK")
%btncancel=$new(button,%fakewidget)
%btncancel->$settext("Cancel")
%layoutbtn->$addwidget(%btnok,0,0)
%layoutbtn->$addwidget(%btncancel,0,1)
#And finally we create a main layout with the groupbox (and its "children")
#and fakewiget (with its buttons children).
%mainlayout=$new(layout,%widget)
%mainlayout->$setspacing(10)
%mainlayout->$setmargin(10)
%mainlayout->$addwidget(%gb,0,0)
%mainlayout->$addwidget(%fakewidget,1,0)
#Let's show our nice login request =D !
%widget->$show()
|