Jump to content

  • Log In with Google      Sign In   
  • Create Account

Qt Widgets resizing incorrectly


Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 TheComet   Crossbones+   -  Reputation: 2463

Like
0Likes
Like

Posted 13 June 2014 - 04:43 AM

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?

 

1.jpg


Edited by TheComet, 13 June 2014 - 04:44 AM.

"Windows 10 doesn't only include spyware, it is designed as spyware" -- Gaius Publius, The Big Picture RT Interview

"[...] we will access, disclose and preserve personal data, including your content (such as the content of your emails, other private communications or files in private folders), when we have a good faith belief that doing so is necessary" -- Windows 10 Privacy Statement


#2 BitMaster   Crossbones+   -  Reputation: 7745

Like
1Likes
Like

Posted 13 June 2014 - 05:00 AM

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.

#3 Bregma   Crossbones+   -  Reputation: 7616

Like
0Likes
Like

Posted 13 June 2014 - 05:06 AM

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


Stephen M. Webb
Professional Free Software Developer

#4 TheComet   Crossbones+   -  Reputation: 2463

Like
0Likes
Like

Posted 13 June 2014 - 05:12 AM

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 )


"Windows 10 doesn't only include spyware, it is designed as spyware" -- Gaius Publius, The Big Picture RT Interview

"[...] we will access, disclose and preserve personal data, including your content (such as the content of your emails, other private communications or files in private folders), when we have a good faith belief that doing so is necessary" -- Windows 10 Privacy Statement





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.




PARTNERS