MistyD
MistyD

Reputation: 17223

QSpacerItem expand horizontally

I would like my spacer item to push everything to the left. Currently this is what I do

QSpacerItem* spc = new QSpacerItem(5000000, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);

I wanted to know what was the correct way. I am currently setting the width to a very large number.

Upvotes: 1

Views: 2300

Answers (1)

thuga
thuga

Reputation: 12931

0,0 with expanding horizontal size policy should work.

QSpacerItem* spc = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding);

You can also see the QBoxLayout source code to see how Qt does it.

Upvotes: 2

Related Questions