![]() |
![]() |
tabWidget class Provides a Tab Widget. |
||||||||||||||||||||||||||||||||||||
Inherits |
||||||||||||||||||||||||||||||||||||
object widget | ||||||||||||||||||||||||||||||||||||
Description |
||||||||||||||||||||||||||||||||||||
The tabWidget class provides a stack of tabbed widgets. Each tab is associated with a different widget (called a `page'). Only the current tab's page is shown in the page area; all the others tabs pages are hidden. The user can show a different page by clicking on its tab. |
||||||||||||||||||||||||||||||||||||
Functions |
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Signals |
||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||
Examples |
||||||||||||||||||||||||||||||||||||
// First we'll create the main tabWidget.
%Tabwidget=$new(tabWidget)
%Tabwidget->$setToolTip("Example of TabWidget class")
%Tabwidget->$setTabPosition(Top)
%Tabwidget->$resize(300,200)
// Now we'll create the new widgets and put they in to the main tabWidget.
%firsttab=$new(vbox)
%secondtab=$new(vbox)
// Now we'll create the item to put in to tab's pages.
// First tab
%hbox=$new(hbox,%firsttab)
%labelbt=$new(label,%hbox)
%labelbt->$settext(Botton Tab)
%labeltt=$new(label,%hbox)
%labeltt->$settext(Top Tab)
%hbox=$new(hbox,%firsttab)
%buttontb=$new(button,%hbox)
%buttontb->$settext("To &Botton")
%buttontt=$new(button,%hbox)
%buttontt->$settext("To &Top")
// Now we'll give a layout to all items.
// This also allows to use privateimpl without making buttons global variables
// Add the page to the main tab.
%Tabwidget->$addTab(%firsttab,Top&Button,33)
// Implementing the action to do when the user click the buttons.
privateimpl(%buttontb,mousepressevent)
{
%Tabwidget->$setTabPosition(Bottom)
}
privateimpl(%buttontt,mousepressevent)
{
%Tabwidget->$setTabPosition(Top)
}
// We do the same work with the second tab's page.
%labelwp=$new(label,%secondtab)
%labelwp->$settext("Enjoy the new Class provided by")
%labelwp->$setalignment("Center")
%labelgen=$new(label,%secondtab)
%labelgen->$settext(Grifisx \& Noldor)
%labelgen->$setalignment("Center")
%Tabwidget->$addTab(%secondtab,&About,50)
// Let's show our example.
%Tabwidget->$show()
|