Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Qt Widgets resizing incorrectly

4: Adsense

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   Members   

3860
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.

"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty

#2 BitMaster   Members   

8647
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   Members   

9098
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   Members   

3860
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 )


"I would try to find halo source code by bungie best fps engine ever created, u see why call of duty loses speed due to its detail." -- GettingNifty




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.