Get size of mainwindow and set width and height of a widget
-
so what i have made is this
void MainWindow::on_pushButtonMaximize_clicked() { QSize size = this->size(); if(isMaximized() == false) { showMaximized(); ui->quickWidget->setGeometry(0, 0, size.width(), size.height()); } else { showNormal(); ui->quickWidget->setGeometry(0, 0, 1280, 720); } qDebug() << "MainWindow Width : " << this->size().width() << "MainWindow Height : " << this->size().height(); }what im trying todo is on
showMaximizedi want to set quickWidget to the size of mainwindow and then hard set it back whenshowNormalis setbut when i press the
Maximize button (to maximize the window)i only get the "current" so1280x720
and when i press theMaximize buttonagain THEN it gets the1920x1080im having a huge brainfart over this.... how to fix this?
-
Use layouts instead.
-
Use layouts instead.
@Christian-Ehrlicher i cant that is the problem! AFAIK i cant have a layout the way i have setup this

the quickWidget is QML file with an animation background and then i have the
frame (QFrame)onTOP of that! when using layout this is not possible AFAIK! -
@Christian-Ehrlicher i cant that is the problem! AFAIK i cant have a layout the way i have setup this

the quickWidget is QML file with an animation background and then i have the
frame (QFrame)onTOP of that! when using layout this is not possible AFAIK!@Kris-Revi According to the picture quickWidget is child of frame_2 (means quickWidget is INSIDE frame_2). So, why can't you have a layout?
-
@Kris-Revi According to the picture quickWidget is child of frame_2 (means quickWidget is INSIDE frame_2). So, why can't you have a layout?
-
```QRect mainGm = ui->centralwidget->geometry();
ui->yourWidget->setGeometry(mainGm);Get geometry and set the geometry of children widget