Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


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: 1623

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.

YOUR_OPINION >/dev/null

Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 4275

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: 5250

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: 1623

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 )


YOUR_OPINION >/dev/null




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