Jump to content
  • Advertisement
Sign in to follow this  
TheComet

Qt Widgets resizing incorrectly

This topic is 1528 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm breaking my head over this silly problem here. I'm dynamically creating QwtPlot widgets and adding them to a QGridLayout.

 

If the plots don't have any curves attached to them, the height of each plot resizes evenly when I stretch the window (left screen shot).

 

If I add curves to the plots, then they don't resize evenly anymore (see right screen shot). As can be seen, the one at the top decides to consume the most space, and the one at the bottom decides to consume the least space. Why is this happening and how can I make them resize evenly again?

 

[attachment=22110:1.jpg]

Edited by TheComet

Share this post


Link to post
Share on other sites
Advertisement
I can't be certain since I don't know the widgets in question but I would assume they set different preferredHeights depending on what data they contain. It should be probably be enough to set the same non-zero stretch factor for each row.

Share this post


Link to post
Share on other sites

When I've had similar problems in the past it's because I forgot to add a QLayout to the base widget.

Share this post


Link to post
Share on other sites

Thanks guys! Stretch factors was exactly what I needed!

 

I simply set all row stretch factors to 1 using QGridLayout::setRowStretch ( int row, int stretch )

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!