[Qt-interest] Change QGraphicsItem size according to QGraphicsLayout

Sean Harmer sean.harmer at maps-technology.com
Fri Jun 25 09:06:27 CEST 2010


Hi,

On Friday 25 June 2010 08:00:08 Ori Lahav wrote: 
> I have a QGraphicsItem placed inside a scene, and a QGraphicsLayout with
> some widgets in it. The layout with the widgets inside that QGraphicsLayout
> (some of them are QGraphicsProxyWidget) takes more space than the size of
> the parent QGraphicsItem. How can I tell QGraphicsItem to change it size to
> the minimum size of its layout?

QGraphicsLayout inherits QGraphicsLayoutItem which looks to have many 
functions for adjusting sizes:

void	setMaximumHeight ( qreal height )
void	setMaximumSize ( const QSizeF & size )
void	setMaximumSize ( qreal w, qreal h )
void	setMaximumWidth ( qreal width )
void	setMinimumHeight ( qreal height )
void	setMinimumSize ( const QSizeF & size )
void	setMinimumSize ( qreal w, qreal h )
void	setMinimumWidth ( qreal width )
void	setPreferredHeight ( qreal height )
void	setPreferredSize ( const QSizeF & size )
void	setPreferredSize ( qreal w, qreal h )
void	setPreferredWidth ( qreal width )
void	setSizePolicy ( const QSizePolicy & policy )
void	setSizePolicy ( QSizePolicy::Policy hPolicy, QSizePolicy::Policy 
vPolicy, QSizePolicy::ControlType controlType = QSizePolicy::DefaultType )

Have you tried any of those?

Sean



More information about the Qt-interest-old mailing list