Unsolved calculate dimension of groupBox
-
I wrote in the show Event:
MainWindow::setFixedSize(QSize(width_primo_schermo,available_height_first_screen)); qDebug()<<"Massima"; qDebug()<<this->size().width(); qDebug()<<ui->groupBox_9->size().width(); qDebug()<<ui->GroupBox1_Acquisizione->size().width();
but the dimension of groupBox isn't right, the others are right
-
Hi
Try
ui->groupBox->width();
instead. -
@mrjj it's the same, maybe it's beacuse the groupBox_9 isn't fixed, it adapts to the dimension of MainWindow, but if I write in this way the dimension of groupBox isn't right
-
@vale88
Hi
Normally it just works
if i dovoid MainWindow::showEvent(QShowEvent *event) { qDebug() << ui->groupBox->width(); }
its exactly the width i see in Designer.
So you must be doing other stuff to the groupBox. -
@mrjj what's other stuff?
-
@vale88 it's a groupbox in gridlayout inside the mainWindow and inside the groupBox there is a layout
-
@vale88 is the groupbox also shown, together with the mainwindow?
for whatever reason, resize events of hidden widgets seem to be delayed until they are shown.
Had some serious trouble with that as well.
-
@J.Hilk so how must I write?
-
@J.Hilk yes is shown with mainWindow
-
@vale88 Is the size of GroupBox1_Acquisizione correct (I assume it is a QGroupBox as well)?
-
@jsulm yes, but it's fixed, the other groupBox isn't fixed
-
@vale88 is the other one in a layout or how do you define it's pos and size?
-
@J.Hilk the other one in a lyout but its dimension is fixed
-
@vale88
let me rephrase that,the one that does not report the expected size back,
is that in a layout or not.
Do you resize it automatically or by hand
have you set a fixedSize on it,
what is the sizePolicy
what is max and min size -
@J.Hilk
the groupBox is inside the stacked widget, between the mainWindow and the layout red, and the mainWindow and the stacked have a layout in grid, and I put the value of the groupBox