Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

scroll area in qstackedwidget

$
0
0
Hello. One of the last issues in my first application. It is a qstackedwidget with several panels in it. The size of the mainwindow is 1280 by 760. When someone opens the application on a low-res computer, a part of the application is cut off. So what I want to do is to have a maximum size set to 1280 by 800 and the minimum size set to 800 by 600. So when a user opens it on a low-res s/he can downsize it. Then the idea is that when the application is downsized, the user has scroll bars (vertical and horizontal). But only when the size is less than the maximum. I have inserted the following in the constructor: MainWindow::MainWindow(QWidget *parent) :     QMainWindow(parent),     ui(new Ui::MainWindow) {     ui->setupUi(this);     this->setMaximumSize(1280,800);     this->setMinimumSize(800,600);       QScrollArea *scrollarea = new QScrollArea;     scrollarea->setWidget(ui->stackedWidget);     scrollarea->setHorizontalScrollBar(Qt::ScrollBarAsNeeded);     scrollarea->setVerticalScrollBar(Qt::ScrollBarAsNeeded);     scrollarea->setWidgetResizable(true); I am not even sure whether this is correct as I get the following error: no matching function for call to QScrollArea::setHorizontalScrollBar I was wondering if my approach is correct. I also tried to add a scroll area in Qt Creator and move my widgets there. But what I get is a scroll area with scroll bars in the maximum size that do not appear when the size is reduced. I have no idea. Thanks a lot!

Viewing all articles
Browse latest Browse all 13965

Trending Articles