Controlling the size of a QScrollArea's viewport



  • I'm trying to figure out how (in a cross-platform manner) to calculate the height to which I need to resize a QScrollArea such that the vertical scroll bar will not appear -- in other words, the viewport will exactly fit the internal widget on the vertical dimension, needing only to scroll horizontally. This is turning out to be a more elusive goal than I'd anticipated, because taking the QScrollArea's framegeometry()->height() is only providing me with the width of the upper frame (I assume because it hasn't yet been resized), and adding to this height that of the internal widget + the height of the horizontal scroll bar still leaves me 6 - 9 pixels short (depending on the machine).


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.