Russian Qt Forum

Qt => Пользовательский интерфейс (GUI) => Тема начата: bigirbis от Октябрь 04, 2007, 13:18



Название: hasHeightForWidth
Отправлено: bigirbis от Октябрь 04, 2007, 13:18
Требуется сделать виджет, который в количестве нескольких штук втыкается в layout и далее изменяет свой размер сохраняя пропорции 4:3.
Ассистант гласит:
Цитировать
If the preferred height of your widget depends on its actual width (e.g., a label with automatic word-breaking), set the height-for-width flag in the widget's size policy and reimplement QWidget::heightForWidth().
Переопределил heightForWidth(), установил флаг setHeightForWidth().
Но ожидаемого результата почему-то не происходит.
Qt 4.2.2

Кто-нибудь сталкивался с такой проблемой?
Заранее спасибо.


Название: Re: hasHeightForWidth
Отправлено: Tonal от Октябрь 04, 2007, 15:09
sizePolisi.horizontalStrech, sizePolisi.verticalStrech - не оно?


Название: Re: hasHeightForWidth
Отправлено: bigirbis от Октябрь 04, 2007, 15:29
Цитировать
Stretch Factors
Widgets are normally created without any stretch factor set. When they are laid out in a layout the widgets are given a share of space in accordance with their QWidget::sizePolicy() or their minimum size hint whichever is the greater. Stretch factors are used to change how much space widgets are given in proportion to one another.
Это совсем другое - выделение пространства в layout в зависимости от предустановленного stretchFactor.