Important: Please read the Qt Code of Conduct -

AddSpacing(): something better than pixels?

  • While I very much like the concept of QVBoxLayout and QHBoxLayout (which resembles TeX's \hbox and \vbox commands a lot), I very much dislike that I have to give pixels as an argument to addSpacing(). Isn't there something better available, say, something comparable to TeX's ex' orem' unit (the height of a small letter `x' and the nominal size of a font, respectively)? Or maybe a percentage as used in CSS?


  • You can get the sizing you're looking for by using QFontMetrics. Still, I'd suggest to use an elastic spacing (\vspace*?) with add/insertStretch.

  • Thanks. BTW, TeX's \vspace is not elastic :-)

Log in to reply