c++ - QHBoxLayout widget alignment only affects first widget -


when create qhboxlayout , add widgets in addwidget , call mylayout->setalignment(newwidget, qt::alignleft), snaps first widget add. when add other widgets , set alignment left too, still start off @ center of layout , squeezed in more widgets add. how make them stick left next each other?

if understood correct, want have widgets in horizontal line left possible?

if can add qhboxlayot general this->getlayout()->addlayout(yourlayout)and use setcontentmargins(); or setstretchfactor(qwidget * widget, int stretch)

without code difficult ... possible problem can widgets size. can fix using setsizepolicy(...) minimumexpanding setsizepolicy( qsizepolicy::minimumexpanding, qsizepolicy::preferred );


Comments