On Sunday 01 March 2009 23:02:39 Craig Scott wrote: > I understand there's no API and that it's not currently in the roadmap, > but consider widgets that need to reimplement their sizeHint() function. > A good example of a motivating case is a QLabel with word wrapping > enabled. The sizeHint() changes depending on what horizontal constraints > are placed on the widget. While it could be argued that the size hint > specifies what the widget wants in an unconstrained world, it still > makes sense (to me at least) that if it can be told about its > constraints then it should be able to give the best possible size hint. > If the width is constrained such that the label has to wrap, then the > sizeHint() should have a deeper height to reflect this. I would have > thought that this particular example would occur frequently enough to > warrant some consideration. At the moment, if a widget's style sheet > contains non-zero padding or borders, there is no way for a > reimplemented sizeHint() to know about it and therefore it is not > possible to account for it.
You can call some style prinitives, such as style()->subElementRect(QStyle::SE_FrameContents , &opt, this); And use the difference between opt.rect and the returned rect to get the margins you should apply. _______________________________________________ Qt4-preview-feedback mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback
