Qt 4.8
Public Functions | Public Variables | List of all members
QToolBarAreaLayoutItem Class Reference

#include <qtoolbararealayout_p.h>

Public Functions

void extendSize (Qt::Orientation o, int extent)
 
QSize minimumSize () const
 
 QToolBarAreaLayoutItem (QLayoutItem *item=0)
 
QSize realSizeHint () const
 
void resize (Qt::Orientation o, int newSize)
 
QSize sizeHint () const
 
bool skip () const
 

Public Variables

bool gap
 
int pos
 
int preferredSize
 
int size
 
QLayoutItem * widgetItem
 

Detailed Description

Definition at line 96 of file qtoolbararealayout_p.h.

Constructors and Destructors

◆ QToolBarAreaLayoutItem()

QToolBarAreaLayoutItem::QToolBarAreaLayoutItem ( QLayoutItem *  item = 0)
inline

Functions

◆ extendSize()

void QToolBarAreaLayoutItem::extendSize ( Qt::Orientation  o,
int  extent 
)
inline

Definition at line 119 of file qtoolbararealayout_p.h.

Referenced by QToolBarAreaLayoutInfo::moveToolBar().

120  {
121  int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : pick(o, sizeHint())) + extent);
122  int sizeh = pick(o, sizeHint());
123  if (newSize == sizeh) {
124  preferredSize = -1;
125  size = sizeh;
126  } else {
127  preferredSize = newSize;
128  }
129  }
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static int pick(Qt::Orientation o, const QPoint &pos)

◆ minimumSize()

QSize QToolBarAreaLayoutItem::minimumSize ( ) const

Definition at line 65 of file qtoolbararealayout.cpp.

Referenced by extendSize(), QToolBarAreaLayoutLine::fitLayout(), QToolBarAreaLayoutLine::minimumSize(), QToolBarAreaLayoutInfo::moveToolBar(), QToolBarAreaLayoutItem(), and resize().

66 {
67  if (skip())
68  return QSize(0, 0);
69  return qSmartMinSize(static_cast<QWidgetItem*>(widgetItem));
70 }
Q_GUI_EXPORT QSize qSmartMinSize(const QSize &sizeHint, const QSize &minSizeHint, const QSize &minSize, const QSize &maxSize, const QSizePolicy &sizePolicy)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ realSizeHint()

QSize QToolBarAreaLayoutItem::realSizeHint ( ) const

Definition at line 81 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayoutItem(), and sizeHint().

82 {
83  QWidget *wid = widgetItem->widget();
84  QSize s = wid->sizeHint().expandedTo(wid->minimumSizeHint());
86  s.setWidth(0);
88  s.setHeight(0);
89  s = s.boundedTo(wid->maximumSize())
90  .expandedTo(wid->minimumSize());
91  return s;
92 }
QSize maximumSize
the widget&#39;s maximum size in pixels
Definition: qwidget.h:173
QSize minimumSize
the widget&#39;s minimum size
Definition: qwidget.h:172
Policy horizontalPolicy() const
Definition: qsizepolicy.h:118
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
Definition: qsize.h:187
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
QSize boundedTo(const QSize &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
Definition: qsize.h:192
void setWidth(int w)
Sets the width to the given width.
Definition: qsize.h:132
QSize minimumSizeHint
the recommended minimum size for the widget
Definition: qwidget.h:196
QSizePolicy sizePolicy
the default layout behavior of the widget
Definition: qwidget.h:171
Policy verticalPolicy() const
Definition: qsizepolicy.h:119
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QSize sizeHint
the recommended size for the widget
Definition: qwidget.h:195

◆ resize()

void QToolBarAreaLayoutItem::resize ( Qt::Orientation  o,
int  newSize 
)
inline

Definition at line 107 of file qtoolbararealayout_p.h.

Referenced by QToolBarAreaLayoutInfo::insertGap(), QToolBarAreaLayoutInfo::moveToolBar(), and QToolBarAreaLayout::unplug().

108  {
109  newSize = qMax(pick(o, minimumSize()), newSize);
110  int sizeh = pick(o, sizeHint());
111  if (newSize == sizeh) {
112  preferredSize = -1;
113  size = sizeh;
114  } else {
115  preferredSize = newSize;
116  }
117  }
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static int pick(Qt::Orientation o, const QPoint &pos)

◆ sizeHint()

QSize QToolBarAreaLayoutItem::sizeHint ( ) const

Definition at line 72 of file qtoolbararealayout.cpp.

Referenced by extendSize(), QToolBarAreaLayoutLine::fitLayout(), QToolBarAreaLayoutInfo::gapIndex(), QToolBarAreaLayoutInfo::insertGap(), QToolBarAreaLayoutInfo::moveToolBar(), QToolBarAreaLayoutItem(), resize(), QToolBarAreaLayoutLine::sizeHint(), and QToolBarAreaLayout::unplug().

73 {
74  if (skip())
75  return QSize(0, 0);
76 
77  return realSizeHint();
78 }
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ skip()

bool QToolBarAreaLayoutItem::skip ( ) const

Properties

◆ gap

bool QToolBarAreaLayoutItem::gap

◆ pos

int QToolBarAreaLayoutItem::pos

◆ preferredSize

int QToolBarAreaLayoutItem::preferredSize

◆ size

int QToolBarAreaLayoutItem::size

◆ widgetItem

QLayoutItem* QToolBarAreaLayoutItem::widgetItem

The documentation for this class was generated from the following files: