I've QGridLayout on my widget and I need to add several elements to it during runtime.
Everything is fine, but I need to calculate and store proper height for added elements. I've tried to get it through
Qt Code:
  1. ui->setupUi(this);
  2. ...
  3. createRuler(minValue, maxValue, steps);
To copy to clipboard, switch view to plain text mode 
in createRuler I've tried this :
Qt Code:
  1. int frame_height = ui->rulerLayout->geometry().height() / steps;
To copy to clipboard, switch view to plain text mode 
But it allways return 0; However inside setupUi there is a code :
Qt Code:
  1. gridLayoutWidget = new QWidget(rulerFrame);
  2. gridLayoutWidget->setObjectName(QString::fromUtf8("gridLayoutWidget"));
  3. gridLayoutWidget->setGeometry(QRect(0, 0, 61, 361));
  4. rulerLayout = new QGridLayout(gridLayoutWidget);
  5. rulerLayout->setSpacing(6);
  6. rulerLayout->setMargin(11);
  7. rulerLayout->setObjectName(QString::fromUtf8("rulerLayout"));
  8. rulerLayout->setSizeConstraint(QLayout::SetMinAndMaxSize);
  9. rulerLayout->setContentsMargins(0, 0, 0, 0);
  10.  
  11. horizontalLayout->addWidget(rulerFrame);
To copy to clipboard, switch view to plain text mode