baray98
20th September 2007, 16:35
I have made a widget with the following
FrameInfo::FrameInfo(QWidget* parent )
:QGroupBox(parent)
{
//ctor
QVBoxLayout *topLayout = new QVBoxLayout(this);
QScrollArea* scrollArea = new QScrollArea(this);
topLayout->addWidget(scrollArea);
setLayout(topLayout);
//Now, for the group box
holder = new QWidget(scrollArea);
mainLayout = new QVBoxLayout(holder);
holder->setLayout(mainLayout);
mainLayout->addStretch();
scrollArea->setWidget(holder);
}
and a function like this
void FrameInfo::addInfo (QString infoName, QString val)
{
QHBoxLayout* infoLayout = new QHBoxLayout;
QLabel* lblValue = new QLabel (infoName,holder);
infoLayout->addWidget(lblValue);
QLineEdit* leValue = new QLineEdit (val,holder);
leValue->setReadOnly ( true );
leValue->setAlignment(Qt::AlignRight);
infoLayout->addWidget(leValue);
infoLayout->addStretch();
mainLayout->insertLayout(mainLayout->count()-1,infoLayout);
holder->adjustSize();
}
the symptom is that when this widget is not hidden and i will call addInfo I won't see my QLabel and QLineEdit anywhere, but if this widget is hidden ( not the current tab for the tabwidget) then call addInfo, when i let it show (by clicking the tab making this widget the current tab widget index ) then ill see them happy and breathing.
please help my widget ease with this sickness,
baray98
FrameInfo::FrameInfo(QWidget* parent )
:QGroupBox(parent)
{
//ctor
QVBoxLayout *topLayout = new QVBoxLayout(this);
QScrollArea* scrollArea = new QScrollArea(this);
topLayout->addWidget(scrollArea);
setLayout(topLayout);
//Now, for the group box
holder = new QWidget(scrollArea);
mainLayout = new QVBoxLayout(holder);
holder->setLayout(mainLayout);
mainLayout->addStretch();
scrollArea->setWidget(holder);
}
and a function like this
void FrameInfo::addInfo (QString infoName, QString val)
{
QHBoxLayout* infoLayout = new QHBoxLayout;
QLabel* lblValue = new QLabel (infoName,holder);
infoLayout->addWidget(lblValue);
QLineEdit* leValue = new QLineEdit (val,holder);
leValue->setReadOnly ( true );
leValue->setAlignment(Qt::AlignRight);
infoLayout->addWidget(leValue);
infoLayout->addStretch();
mainLayout->insertLayout(mainLayout->count()-1,infoLayout);
holder->adjustSize();
}
the symptom is that when this widget is not hidden and i will call addInfo I won't see my QLabel and QLineEdit anywhere, but if this widget is hidden ( not the current tab for the tabwidget) then call addInfo, when i let it show (by clicking the tab making this widget the current tab widget index ) then ill see them happy and breathing.
please help my widget ease with this sickness,
baray98