PDA

View Full Version : adding my wdget to Tab



therealjag
18th February 2006, 20:16
hello there i have tried making a modfied verson of the tooltips example in the documentation. i want to add the widget to a tab(another application) that i have implemented but im not sure about how to add it...

ive tried using the following code but it doesnt seem to work...do i have to make any amendments to the tooltips files i.e. with sortingBox.cpp?? any tips would be really helpful, thanks. Jag

CreatorTab::CreatorTab(const QFileInfo &fileInfo, QWidget *parent)
: QWidget(parent)
{

1. sortingBox = new SortingBox;
2. QHBoxLayout *mainLayout = new QHBoxLayout;
3. mainLayout->addWidget(sortingBox);
4. mainLayout->addStretch(1);
5. setLayout(mainLayout);

}

therealjag
18th February 2006, 20:27
sorry yep i figured it out - i got rid of addStretch()

jacek
18th February 2006, 20:28
Try:
CreatorTab::CreatorTab(const QFileInfo &fileInfo, QWidget *parent)
: QWidget(parent)
{
sortingBox = new SortingBox( this );
QHBoxLayout *mainLayout = new QHBoxLayout( this );
mainLayout->addWidget(sortingBox);
mainLayout->addStretch(1);
setLayout(mainLayout);
}