How to find the height and width of a QVBoxLayout / QHBoxLayout?
-
@int myBoxLayoutheight = ui->QBoxLayout->height
int myBoxLayoutwidtht = ui->QBoxLayout->width@but that doesn't work, please help me ;)
-
This should be what you want:
@
QRect geometry = ui->QBoxLayout->contentsRect();
int width = geometry.width();
// ...
@ -
Unless you actually named it like that (which is quite misleading and not a good idea), QBoxLayout is a type, not a variable, -and width and height are funcions, not variables, so:-
Scratch that, not enough coffee today :) contentsRect() is the way to go as previously stated. -
You can use geometry() function of QBoxLayout .
For Eg. :
QRect geometry = ui->QBoxLayout->geometry();
int width = geometry.width();
int height = geometry.height();