Hi everyone,
I'm finding some problems when I try to add a QScrollArea to QWizardPage widget.
Below is the code:
//header WizarPage file
#ifndef SCROLLPAGE_H
#define SCROLLPAGE_H
#include <QtGui>
#include <QWizardPage>
#define ITEM 20
class scrollPage: public QWizardPage
{
Q_OBJECT
public:
scrollPage(QWidget *parent = 0);
protected:
void initializePage();
private:
QLabel name[ITEM];
QLabel data[ITEM];
QPushButton ButInfo[ITEM];
QHBoxLayout lineH[ITEM];
};
#endif // SCROLLPAGE_H
//WizardPage implementation
scrollPage::scrollPage(QWidget *parent)
: QWizardPage(parent)
{
setTitle(tr("SCROLL page title"));
}
void scrollPage::initializePage()
{
int i = 0;
/* scroll area */
QScrollArea* sa = new QScrollArea;
sa->setWidgetResizable(true);
QScrollBar *scrollBar = sa->verticalScrollBar();
scrollBar->setSliderDown( true );
scrollBar->setValue(0);
sa->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn) ;
sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysO ff);
QVBoxLayout * Elenco1 = new QVBoxLayout(sa);
sa->setLayout(Elenco1);
while(i< ITEM)
{
name[i].setText(tr("NAME"));
data[i].setText(tr("DATA"));
ButInfo[i].setText("Info");
lineH[i].addWidget(&name[i]);
lineH[i].addWidget(&data[i]);
lineH[i].addWidget(&ButInfo[i]);
Elenco1->addLayout(&lineH[i]);
i++;
}
QVBoxLayout * ShowLayout = new QVBoxLayout;
ShowLayout->addWidget(sa);
setLayout(ShowLayout);
}
When I run the program happens that the page displays a scroll area, but the layout is resized and the page does not scroll.
Unfortunately they are still a beginner, but if anyone can help I would be very grateful!
Sincerely,
Ale
Bookmarks