I just have a Scroll Area widget that consists of several Qlabels .
take a look at the situation:
I tried to to do the following but it didn't work out, its doesn't scroll ...
#include "form1.h"
#include &qu开发者_开发知识库ot;form.h"
#include "ui_form.h"
#include "ui_form1.h"
#include<QScrollArea>
#include<QScrollBar>
Form::Form(QWidget *parent) :
QWidget(parent),
ui(new Ui::Form)
{
ui->setupUi(this);
ui->scrollAreaWidgetContents->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
ui->scrollAreaWidgetContents->resize(ui->scrollArea->size().width() ,ui->scrollArea->size().height());
ui->scrollArea->setWidgetResizable(true);
ui->scrollArea->setWidget(ui->scrollAreaWidgetContents);
ui->scrollAreaWidgetContents->adjustSize();
}
Please Can you tell me what am doing wrong or what am not understanding ?? please be specific , I would appreciate it...
Did you apply a layout to the QScrollArea?
In the designer, select the QScrollArea and then click on one of the layout buttons (or press CTRL-L). This may not give you exactly what you want, but if things can then scroll, you know that the layout is the problem.
精彩评论