QScrollarea in verticalLayout
-
@hjohn said in QScrollarea in verticalLayout:
which widget i have to set?
any widget.
QWidget* w = new QWidget( this ); w->setLayout(ui->verticalLayout); QScrollArea *area = new QScrollArea(this); area->setWidget(w);
-
@raven-worx Its Done..Thank you very much for quick reply.thanks for Help. :)
-
widget.cpp
#include "widget.h" #include "ui_widget.h" #include<QScrollArea> #include<QPushButton> #include<QDebug> Widget::Widget(QWidget *parent) : QWidget(parent), ui(new Ui::Widget) { ui->setupUi(this); QWidget *W=new QWidget(this); W->setLayout(ui->verticalLayout); QScrollArea *area=new QScrollArea(this); area->setWidget(W); } Widget::~Widget() { delete ui; }
output :
as its visible in the image , it doesn't look proper. How do I fix it ?
-
@hjohn said in QScrollarea in verticalLayout:
it doesn't look proper. How do I fix it ?
define proper. What exactly do you want to achieve?
-
@raven-worx Proper:Without horizontal scrollBar, I mean if we want to see the whole button we have to scroll . I don't want to scroll horizontally.
-
Hi,
Since you are using Designer, why don't you put the QScrollArea directly in your ui ?
-
Why is that ?
-
Then I'd recommend to start by doing the whole interface in code only. Once you are confortable with that, you can start mixing designer and code generate widgets.
There are subtleties when mixing that you have to take into account.