[Qt-interest] Setting all columns of a QHBoxLayout to have the same width
Brad Howes
howes at ll.mit.edu
Thu Aug 12 17:53:31 CEST 2010
On Aug 12, 2010, at 11:29 AM, Felipe Sodré Silva wrote:
> I'm trying that, but how can I get the width of the largest column after I add all widgets in there ?
>
> On Thu, Aug 12, 2010 at 12:01 PM, Brad Howes <howes at ll.mit.edu> wrote:
> Use QGridLayout instead, with just one row.
Ack! My bad advice. The default behavior for the layout is to partition the available space to all columns except that it will honor the managed widget's sizePolicy value. The default value for sizePolicy is 'preferred' -- change the horizontal policy of the managed widgets to 'ignored' so that the layout widget will always partition the widgets to the desired value.
However, I suspect you want the layout to demand N * maxWidth space for N managed widgets where maxWidth is the largest preferred width found among the N widgets. I suspect you will have to derive from, say QHBoxLayout, and implement your own minimumSize() (and perhaps invalidate() too) which will visit all children, ask each for their minimumSize() value, and return the largest value found * N plus some margin and spacing values.
Sorry for the misdirection.
Brad
--
Brad Howes
Group 42
MIT Lincoln Laboratory • 244 Wood St. • Lexington, MA 02173
Phone: 781.981.5292 • Fax: 781.981.3495 • Secretary: 781.981.7420
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100812/9ef280bc/attachment.html
More information about the Qt-interest-old
mailing list