Qt 4.8
Public Functions | Public Variables | List of all members
QBoxLayoutItem Struct Reference

Public Functions

int hfw (int w)
 
int hStretch ()
 
int mhfw (int w)
 
 QBoxLayoutItem (QLayoutItem *it, int stretch_=0)
 
int vStretch ()
 
 ~QBoxLayoutItem ()
 

Public Variables

QLayoutItemitem
 
bool magic
 
int stretch
 

Detailed Description

Definition at line 68 of file qboxlayout.cpp.

Constructors and Destructors

◆ QBoxLayoutItem()

QBoxLayoutItem::QBoxLayoutItem ( QLayoutItem it,
int  stretch_ = 0 
)
inline

Definition at line 70 of file qboxlayout.cpp.

71  : item(it), stretch(stretch_), magic(false) { }
QLayoutItem * item
Definition: qboxlayout.cpp:103

◆ ~QBoxLayoutItem()

QBoxLayoutItem::~QBoxLayoutItem ( )
inline

Definition at line 72 of file qboxlayout.cpp.

72 { delete item; }
QLayoutItem * item
Definition: qboxlayout.cpp:103

Functions

◆ hfw()

int QBoxLayoutItem::hfw ( int  w)
inline

Definition at line 74 of file qboxlayout.cpp.

Referenced by QBoxLayoutPrivate::calcHfw().

74  {
75  if (item->hasHeightForWidth()) {
76  return item->heightForWidth(w);
77  } else {
78  return item->sizeHint().height();
79  }
80  }
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false...
virtual QSize sizeHint() const =0
Implemented in subclasses to return the preferred size of this item.
int height() const
Returns the height.
Definition: qsize.h:129
QLayoutItem * item
Definition: qboxlayout.cpp:103
virtual int heightForWidth(int) const
Returns the preferred height for this layout item, given the width w.

◆ hStretch()

int QBoxLayoutItem::hStretch ( )
inline

Definition at line 88 of file qboxlayout.cpp.

Referenced by QBoxLayoutPrivate::setupGeom().

88  {
89  if (stretch == 0 && item->widget()) {
90  return item->widget()->sizePolicy().horizontalStretch();
91  } else {
92  return stretch;
93  }
94  }
int horizontalStretch() const
Definition: qsizepolicy.h:144
QSizePolicy sizePolicy
the default layout behavior of the widget
Definition: qwidget.h:171
QLayoutItem * item
Definition: qboxlayout.cpp:103
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.

◆ mhfw()

int QBoxLayoutItem::mhfw ( int  w)
inline

Definition at line 81 of file qboxlayout.cpp.

Referenced by QBoxLayoutPrivate::calcHfw().

81  {
82  if (item->hasHeightForWidth()) {
83  return item->heightForWidth(w);
84  } else {
85  return item->minimumSize().height();
86  }
87  }
virtual QSize minimumSize() const =0
Implemented in subclasses to return the minimum size of this item.
virtual bool hasHeightForWidth() const
Returns true if this layout's preferred height depends on its width; otherwise returns false...
int height() const
Returns the height.
Definition: qsize.h:129
QLayoutItem * item
Definition: qboxlayout.cpp:103
virtual int heightForWidth(int) const
Returns the preferred height for this layout item, given the width w.

◆ vStretch()

int QBoxLayoutItem::vStretch ( )
inline

Definition at line 95 of file qboxlayout.cpp.

Referenced by QBoxLayoutPrivate::setupGeom().

95  {
96  if (stretch == 0 && item->widget()) {
97  return item->widget()->sizePolicy().verticalStretch();
98  } else {
99  return stretch;
100  }
101  }
int verticalStretch() const
Definition: qsizepolicy.h:145
QSizePolicy sizePolicy
the default layout behavior of the widget
Definition: qwidget.h:171
QLayoutItem * item
Definition: qboxlayout.cpp:103
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.

Properties

◆ item

QLayoutItem* QBoxLayoutItem::item

◆ magic

bool QBoxLayoutItem::magic

◆ stretch

int QBoxLayoutItem::stretch

The documentation for this struct was generated from the following file: