Qt 4.8
Public Functions | Private Functions | Properties | List of all members
QGridLayoutPrivate Class Reference
Inheritance diagram for QGridLayoutPrivate:
QLayoutPrivate QObjectPrivate QObjectData

Public Functions

void add (QGridBox *, int row, int col)
 
void add (QGridBox *, int row1, int row2, int col1, int col2)
 
QRect cellRect (int row, int col) const
 
int colSpacing (int c) const
 
int colStretch (int c) const
 
int count () const
 
void deleteAll ()
 
void distribute (QRect rect, int hSpacing, int vSpacing)
 
void expand (int rows, int cols)
 
Qt::Orientations expandingDirections (int hSpacing, int vSpacing) const
 
void getItemPosition (int index, int *row, int *column, int *rowSpan, int *columnSpan)
 
void getNextPos (int &row, int &col)
 
bool hasHeightForWidth (int hSpacing, int vSpacing)
 
int heightForWidth (int width, int hSpacing, int vSpacing)
 
bool horReversed () const
 
bool isDirty () const
 
QLayoutItemitemAt (int index) const
 
QSize maximumSize (int hSpacing, int vSpacing) const
 
int minimumHeightForWidth (int width, int hSpacing, int vSpacing)
 
QSize minimumSize (int hSpacing, int vSpacing) const
 
int numCols () const
 
int numRows () const
 
 QGridLayoutPrivate ()
 
int rowSpacing (int r) const
 
int rowStretch (int r) const
 
void setColStretch (int c, int s)
 
void setColumnMinimumWidth (int c, int s)
 
void setDirty ()
 
void setReversed (bool r, bool c)
 
void setRowMinimumHeight (int r, int s)
 
void setRowStretch (int r, int s)
 
QSize sizeHint (int hSpacing, int vSpacing) const
 
QLayoutItemtakeAt (int index)
 
bool verReversed () const
 
- Public Functions inherited from QLayoutPrivate
void doResize (const QSize &)
 
void getMargin (int *result, int userMargin, QStyle::PixelMetric pm) const
 
 QLayoutPrivate ()
 
void reparentChildWidgets (QWidget *mw)
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Private Functions

void addData (QGridBox *b, const QGridLayoutSizeTriple &sizes, bool r, bool c)
 
void addHfwData (QGridBox *box, int width)
 
void effectiveMargins (int *left, int *top, int *right, int *bottom) const
 
QSize findSize (int QLayoutStruct::*, int hSpacing, int vSpacing) const
 
void init ()
 
void recalcHFW (int w)
 
void setNextPosAfter (int r, int c)
 
void setSize (int rows, int cols)
 
void setupHfwLayoutData ()
 
void setupLayoutData (int hSpacing, int vSpacing)
 
void setupSpacings (QVector< QLayoutStruct > &chain, QGridBox *grid[], int fixedSpacing, Qt::Orientation orientation)
 

Properties

uint addVertical: 1
 
int bottomMargin
 
int cc
 
QVector< int > cMinWidths
 
QVector< QLayoutStructcolData
 
QVector< int > cStretch
 
uint has_hfw: 1
 
int hfw_height
 
int hfw_minheight
 
int hfw_width
 
QVector< QLayoutStruct > * hfwData
 
int horizontalSpacing
 
uint hReversed: 1
 
int leftMargin
 
uint needRecalc: 1
 
int nextC
 
int nextR
 
int rightMargin
 
QVector< int > rMinHeights
 
QVector< QLayoutStructrowData
 
int rr
 
QVector< int > rStretch
 
QList< QGridBox * > things
 
int topMargin
 
int verticalSpacing
 
uint vReversed: 1
 

Additional Inherited Members

- Public Types inherited from QLayoutPrivate
typedef QSpacerItem *(* QSpacerItemFactoryMethod) (const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy, QSizePolicy::Policy)
 
typedef QWidgetItem *(* QWidgetItemFactoryMethod) (const QLayout *layout, QWidget *widget)
 
- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QLayoutPrivate
static QSpacerItemcreateSpacerItem (const QLayout *layout, int w, int h, QSizePolicy::Policy hPolicy=QSizePolicy::Minimum, QSizePolicy::Policy vPolicy=QSizePolicy::Minimum)
 
static QWidgetItemcreateWidgetItem (const QLayout *layout, QWidget *widget)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 
- Public Variables inherited from QLayoutPrivate
uint activated: 1
 
uint autoNewChild: 1
 
QLayout::SizeConstraint constraint
 
uint enabled: 1
 
int insideSpacing
 
QWidgetmenubar
 
QRect rect
 
uint topLevel: 1
 
int userBottomMargin
 
int userLeftMargin
 
int userRightMargin
 
int userTopMargin
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 
- Static Public Variables inherited from QLayoutPrivate
static QSpacerItemFactoryMethod spacerItemFactoryMethod = 0
 
static QWidgetItemFactoryMethod widgetItemFactoryMethod = 0
 

Detailed Description

Definition at line 107 of file qgridlayout.cpp.

Constructors and Destructors

◆ QGridLayoutPrivate()

QGridLayoutPrivate::QGridLayoutPrivate ( )

Definition at line 328 of file qgridlayout.cpp.

329 {
330  addVertical = false;
331  setDirty();
332  rr = cc = 0;
333  nextR = nextC = 0;
334  hfwData = 0;
335  hReversed = false;
336  vReversed = false;
337  horizontalSpacing = -1;
338  verticalSpacing = -1;
339 }
QVector< QLayoutStruct > * hfwData

Functions

◆ add() [1/2]

void QGridLayoutPrivate::add ( QGridBox box,
int  row,
int  col 
)

Definition at line 543 of file qgridlayout.cpp.

544 {
545  expand(row + 1, col + 1);
546  box->row = box->torow = row;
547  box->col = box->tocol = col;
548  things.append(box);
549  setDirty();
550  setNextPosAfter(row, col);
551 }
QList< QGridBox * > things
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void expand(int rows, int cols)
void setNextPosAfter(int r, int c)

◆ add() [2/2]

void QGridLayoutPrivate::add ( QGridBox box,
int  row1,
int  row2,
int  col1,
int  col2 
)

Definition at line 553 of file qgridlayout.cpp.

554 {
555  if (row2 >= 0 && row2 < row1)
556  qWarning("QGridLayout: Multi-cell fromRow greater than toRow");
557  if (col2 >= 0 && col2 < col1)
558  qWarning("QGridLayout: Multi-cell fromCol greater than toCol");
559  if (row1 == row2 && col1 == col2) {
560  add(box, row1, col1);
561  return;
562  }
563  expand(row2 + 1, col2 + 1);
564  box->row = row1;
565  box->col = col1;
566 
567  box->torow = row2;
568  box->tocol = col2;
569 
570  things.append(box);
571  setDirty();
572  if (col2 < 0)
573  col2 = cc - 1;
574 
575  setNextPosAfter(row2, col2);
576 }
QList< QGridBox * > things
void add(QGridBox *, int row, int col)
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
Q_CORE_EXPORT void qWarning(const char *,...)
void expand(int rows, int cols)
void setNextPosAfter(int r, int c)

◆ addData()

void QGridLayoutPrivate::addData ( QGridBox b,
const QGridLayoutSizeTriple sizes,
bool  r,
bool  c 
)
private

Definition at line 578 of file qgridlayout.cpp.

579 {
580  const QWidget *widget = box->item()->widget();
581 
582  if (box->isEmpty() && widget)
583  return;
584 
585  if (c) {
586  QLayoutStruct *data = &colData[box->col];
587  if (!cStretch.at(box->col))
588  data->stretch = qMax(data->stretch, box->hStretch());
589  data->sizeHint = qMax(sizes.hint.width(), data->sizeHint);
590  data->minimumSize = qMax(sizes.minS.width(), data->minimumSize);
591 
592  qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.width(),
593  box->expandingDirections() & Qt::Horizontal, box->isEmpty());
594  }
595  if (r) {
596  QLayoutStruct *data = &rowData[box->row];
597  if (!rStretch.at(box->row))
598  data->stretch = qMax(data->stretch, box->vStretch());
599  data->sizeHint = qMax(sizes.hint.height(), data->sizeHint);
600  data->minimumSize = qMax(sizes.minS.height(), data->minimumSize);
601 
602  qMaxExpCalc(data->maximumSize, data->expansive, data->empty, sizes.maxS.height(),
603  box->expandingDirections() & Qt::Vertical, box->isEmpty());
604  }
605 }
unsigned char c[8]
Definition: qnumeric_p.h:62
QPointer< QWidget > widget
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QVector< QLayoutStruct > colData
QVector< int > rStretch
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
int width() const
Returns the width.
Definition: qsize.h:126
static const char * data(const QByteArray &arr)
QVector< int > cStretch
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int height() const
Returns the height.
Definition: qsize.h:129
QVector< QLayoutStruct > rowData
static void qMaxExpCalc(int &max, bool &exp, bool &empty, int boxmax, bool boxexp, bool boxempty)

◆ addHfwData()

void QGridLayoutPrivate::addHfwData ( QGridBox box,
int  width 
)
private

Definition at line 854 of file qgridlayout.cpp.

855 {
857  if (box->hasHeightForWidth()) {
858  int hint = box->heightForWidth(width);
859  rData[box->row].sizeHint = qMax(hint, rData.at(box->row).sizeHint);
860  rData[box->row].minimumSize = qMax(hint, rData.at(box->row).minimumSize);
861  } else {
862  QSize hint = box->sizeHint();
863  QSize minS = box->minimumSize();
864  rData[box->row].sizeHint = qMax(hint.height(), rData.at(box->row).sizeHint);
865  rData[box->row].minimumSize = qMax(minS.height(), rData.at(box->row).minimumSize);
866  }
867 }
int heightForWidth(int w) const
Definition: qgridlayout.cpp:82
QVector< QLayoutStruct > * hfwData
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QSize minimumSize() const
Definition: qgridlayout.cpp:76
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int height() const
Returns the height.
Definition: qsize.h:129
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QSize sizeHint() const
Definition: qgridlayout.cpp:75
bool hasHeightForWidth() const
Definition: qgridlayout.cpp:81

◆ cellRect()

QRect QGridLayoutPrivate::cellRect ( int  row,
int  col 
) const

Definition at line 968 of file qgridlayout.cpp.

969 {
970  if (row < 0 || row >= rr || col < 0 || col >= cc)
971  return QRect();
972 
973  const QVector<QLayoutStruct> *rDataPtr;
974  if (has_hfw && hfwData)
975  rDataPtr = hfwData;
976  else
977  rDataPtr = &rowData;
978  return QRect(colData.at(col).pos, rDataPtr->at(row).pos,
979  colData.at(col).size, rDataPtr->at(row).size);
980 }
QVector< QLayoutStruct > * hfwData
QVector< QLayoutStruct > colData
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QVector< QLayoutStruct > rowData

◆ colSpacing()

int QGridLayoutPrivate::colSpacing ( int  c) const
inline

Definition at line 137 of file qgridlayout.cpp.

137 { return cMinWidths.at(c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< int > cMinWidths

◆ colStretch()

int QGridLayoutPrivate::colStretch ( int  c) const
inline

Definition at line 131 of file qgridlayout.cpp.

131 { return cStretch.at(c); }
unsigned char c[8]
Definition: qnumeric_p.h:62
QVector< int > cStretch
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350

◆ count()

int QGridLayoutPrivate::count ( ) const
inline

Definition at line 149 of file qgridlayout.cpp.

149 { return things.count(); }
QList< QGridBox * > things
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891

◆ deleteAll()

void QGridLayoutPrivate::deleteAll ( )

Definition at line 358 of file qgridlayout.cpp.

359 {
360  while (!things.isEmpty())
361  delete things.takeFirst();
362  delete hfwData;
363 }
QList< QGridBox * > things
QVector< QLayoutStruct > * hfwData
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489

◆ distribute()

void QGridLayoutPrivate::distribute ( QRect  rect,
int  hSpacing,
int  vSpacing 
)

Definition at line 917 of file qgridlayout.cpp.

918 {
919  Q_Q(QGridLayout);
920  bool visualHReversed = hReversed;
921  QWidget *parent = q->parentWidget();
922  if (parent && parent->isRightToLeft())
923  visualHReversed = !visualHReversed;
924 
925  setupLayoutData(hSpacing, vSpacing);
926 
927  int left, top, right, bottom;
928  effectiveMargins(&left, &top, &right, &bottom);
929  r.adjust(+left, +top, -right, -bottom);
930 
931  qGeomCalc(colData, 0, cc, r.x(), r.width());
932  QVector<QLayoutStruct> *rDataPtr;
933  if (has_hfw) {
934  recalcHFW(r.width());
935  qGeomCalc(*hfwData, 0, rr, r.y(), r.height());
936  rDataPtr = hfwData;
937  } else {
938  qGeomCalc(rowData, 0, rr, r.y(), r.height());
939  rDataPtr = &rowData;
940  }
941  QVector<QLayoutStruct> &rData = *rDataPtr;
942  int i;
943 
944  bool reverse = ((r.bottom() > rect.bottom()) || (r.bottom() == rect.bottom()
945  && ((r.right() > rect.right()) != visualHReversed)));
946  int n = things.size();
947  for (i = 0; i < n; ++i) {
948  QGridBox *box = things.at(reverse ? n-i-1 : i);
949  int r2 = box->toRow(rr);
950  int c2 = box->toCol(cc);
951 
952  int x = colData.at(box->col).pos;
953  int y = rData.at(box->row).pos;
954  int x2p = colData.at(c2).pos + colData.at(c2).size; // x2+1
955  int y2p = rData.at(r2).pos + rData.at(r2).size; // y2+1
956  int w = x2p - x;
957  int h = y2p - y;
958 
959  if (visualHReversed)
960  x = r.left() + r.right() - x - w + 1;
961  if (vReversed)
962  y = r.top() + r.bottom() - y - h + 1;
963 
964  box->setGeometry(QRect(x, y, w, h));
965  }
966 }
QList< QGridBox * > things
QVector< QLayoutStruct > * hfwData
static C reverse(const C &l)
void recalcHFW(int w)
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QVector< QLayoutStruct > colData
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
void setupLayoutData(int hSpacing, int vSpacing)
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
#define Q_Q(Class)
Definition: qglobal.h:2483
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void effectiveMargins(int *left, int *top, int *right, int *bottom) const
int toRow(int rr) const
Definition: qgridlayout.cpp:99
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
void qGeomCalc(QVector< QLayoutStruct > &chain, int start, int count, int pos, int space, int spacer)
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QObject * parent
Definition: qobject.h:92
int toCol(int cc) const
bool isRightToLeft() const
Definition: qwidget.h:428
QVector< QLayoutStruct > rowData
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
void setGeometry(const QRect &r)
Definition: qgridlayout.cpp:85

◆ effectiveMargins()

void QGridLayoutPrivate::effectiveMargins ( int *  left,
int *  top,
int *  right,
int *  bottom 
) const
private

Definition at line 233 of file qgridlayout.cpp.

234 {
235  int l = leftMargin;
236  int t = topMargin;
237  int r = rightMargin;
238  int b = bottomMargin;
239 #ifdef Q_WS_MAC
240  int leftMost = INT_MAX;
241  int topMost = INT_MAX;
242  int rightMost = 0;
243  int bottomMost = 0;
244 
245  QWidget *w = 0;
246  const int n = things.count();
247  for (int i = 0; i < n; ++i) {
248  QGridBox *box = things.at(i);
249  QLayoutItem *itm = box->item();
250  w = itm->widget();
251  if (w) {
252  bool visualHReversed = hReversed != (w->layoutDirection() == Qt::RightToLeft);
253  QRect lir = itm->geometry();
254  QRect wr = w->geometry();
255  if (box->col <= leftMost) {
256  if (box->col < leftMost) {
257  // we found an item even closer to the margin, discard.
258  leftMost = box->col;
259  if (visualHReversed)
260  r = rightMargin;
261  else
262  l = leftMargin;
263  }
264  if (visualHReversed) {
265  r = qMax(r, wr.right() - lir.right());
266  } else {
267  l = qMax(l, lir.left() - wr.left());
268  }
269  }
270  if (box->row <= topMost) {
271  if (box->row < topMost) {
272  // we found an item even closer to the margin, discard.
273  topMost = box->row;
274  if (vReversed)
275  b = bottomMargin;
276  else
277  t = topMargin;
278  }
279  if (vReversed)
280  b = qMax(b, wr.bottom() - lir.bottom());
281  else
282  t = qMax(t, lir.top() - wr.top());
283  }
284  if (box->toCol(cc) >= rightMost) {
285  if (box->toCol(cc) > rightMost) {
286  // we found an item even closer to the margin, discard.
287  rightMost = box->toCol(cc);
288  if (visualHReversed)
289  l = leftMargin;
290  else
291  r = rightMargin;
292  }
293  if (visualHReversed) {
294  l = qMax(l, lir.left() - wr.left());
295  } else {
296  r = qMax(r, wr.right() - lir.right());
297  }
298 
299  }
300  if (box->toRow(rr) >= bottomMost) {
301  if (box->toRow(rr) > bottomMost) {
302  // we found an item even closer to the margin, discard.
303  bottomMost = box->toRow(rr);
304  if (vReversed)
305  t = topMargin;
306  else
307  b = bottomMargin;
308  }
309  if (vReversed)
310  t = qMax(t, lir.top() - wr.top());
311  else
312  b = qMax(b, wr.bottom() - lir.bottom());
313  }
314  }
315  }
316 
317 #endif
318  if (left)
319  *left = l;
320  if (top)
321  *top = t;
322  if (right)
323  *right = r;
324  if (bottom)
325  *bottom = b;
326 }
QList< QGridBox * > things
virtual QRect geometry() const =0
Returns the rectangle covered by this layout item.
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int toRow(int rr) const
Definition: qgridlayout.cpp:99
Qt::LayoutDirection layoutDirection
the layout direction for this widget
Definition: qwidget.h:216
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QFactoryLoader * l
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
int toCol(int cc) const
QLayoutItem * item()
Definition: qgridlayout.cpp:87
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
#define INT_MAX

◆ expand()

void QGridLayoutPrivate::expand ( int  rows,
int  cols 
)
inline

Definition at line 124 of file qgridlayout.cpp.

125  { setSize(qMax(rows, rr), qMax(cols, cc)); }
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void setSize(int rows, int cols)

◆ expandingDirections()

Qt::Orientations QGridLayoutPrivate::expandingDirections ( int  hSpacing,
int  vSpacing 
) const

Definition at line 444 of file qgridlayout.cpp.

445 {
446  QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this);
447  that->setupLayoutData(hSpacing, vSpacing);
448  Qt::Orientations ret;
449 
450  for (int r = 0; r < rr; r++) {
451  if (rowData.at(r).expansive) {
452  ret |= Qt::Vertical;
453  break;
454  }
455  }
456  for (int c = 0; c < cc; c++) {
457  if (colData.at(c).expansive) {
458  ret |= Qt::Horizontal;
459  break;
460  }
461  }
462  return ret;
463 }
unsigned char c[8]
Definition: qnumeric_p.h:62
QVector< QLayoutStruct > colData
void setupLayoutData(int hSpacing, int vSpacing)
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< QLayoutStruct > rowData

◆ findSize()

QSize QGridLayoutPrivate::findSize ( int QLayoutStruct::*  size,
int  hSpacing,
int  vSpacing 
) const
private

Definition at line 425 of file qgridlayout.cpp.

426 {
427  QGridLayoutPrivate *that = const_cast<QGridLayoutPrivate*>(this);
428  that->setupLayoutData(hSpacing, vSpacing);
429 
430  int w = 0;
431  int h = 0;
432 
433  for (int r = 0; r < rr; r++)
434  h += rowData.at(r).*size + rowData.at(r).spacing;
435  for (int c = 0; c < cc; c++)
436  w += colData.at(c).*size + colData.at(c).spacing;
437 
438  w = qMin(QLAYOUTSIZE_MAX, w);
439  h = qMin(QLAYOUTSIZE_MAX, h);
440 
441  return QSize(w, h);
442 }
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QVector< QLayoutStruct > colData
void setupLayoutData(int hSpacing, int vSpacing)
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QVector< QLayoutStruct > rowData
static const int QLAYOUTSIZE_MAX
Definition: qlayoutitem.h:56

◆ getItemPosition()

void QGridLayoutPrivate::getItemPosition ( int  index,
int *  row,
int *  column,
int *  rowSpan,
int *  columnSpan 
)
inline

Definition at line 175 of file qgridlayout.cpp.

175  {
176  if (index < things.count()) {
177  QGridBox *b = things.at(index);
178  int toRow = b->toRow(rr);
179  int toCol = b->toCol(cc);
180  *row = b->row;
181  *column = b->col;
182  *rowSpan = toRow - *row + 1;
183  *columnSpan = toCol - *column +1;
184  }
185  }
QList< QGridBox * > things
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int toRow(int rr) const
Definition: qgridlayout.cpp:99
quint16 index
int toCol(int cc) const

◆ getNextPos()

void QGridLayoutPrivate::getNextPos ( int &  row,
int &  col 
)
inline

Definition at line 148 of file qgridlayout.cpp.

148 { row = nextR; col = nextC; }

◆ hasHeightForWidth()

bool QGridLayoutPrivate::hasHeightForWidth ( int  hSpacing,
int  vSpacing 
)

Definition at line 365 of file qgridlayout.cpp.

366 {
367  setupLayoutData(hSpacing, vSpacing);
368  return has_hfw;
369 }
void setupLayoutData(int hSpacing, int vSpacing)

◆ heightForWidth()

int QGridLayoutPrivate::heightForWidth ( int  width,
int  hSpacing,
int  vSpacing 
)

Definition at line 399 of file qgridlayout.cpp.

Referenced by QGridLayout::heightForWidth().

400 {
401  setupLayoutData(hSpacing, vSpacing);
402  if (!has_hfw)
403  return -1;
404  int left, top, right, bottom;
405  effectiveMargins(&left, &top, &right, &bottom);
406 
407  int hMargins = left + right;
408  if (w - hMargins != hfw_width) {
409  qGeomCalc(colData, 0, cc, 0, w - hMargins);
410  recalcHFW(w - hMargins);
411  }
412  return hfw_height + top + bottom;
413 }
void recalcHFW(int w)
QVector< QLayoutStruct > colData
void setupLayoutData(int hSpacing, int vSpacing)
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void effectiveMargins(int *left, int *top, int *right, int *bottom) const
void qGeomCalc(QVector< QLayoutStruct > &chain, int start, int count, int pos, int space, int spacer)
Q_CORE_EXPORT QTextStream & left(QTextStream &s)

◆ horReversed()

bool QGridLayoutPrivate::horReversed ( ) const
inline

Definition at line 140 of file qgridlayout.cpp.

140 { return hReversed; }

◆ init()

void QGridLayoutPrivate::init ( )
private

◆ isDirty()

bool QGridLayoutPrivate::isDirty ( ) const
inline

Definition at line 143 of file qgridlayout.cpp.

143 { return needRecalc; }

◆ itemAt()

QLayoutItem* QGridLayoutPrivate::itemAt ( int  index) const
inline

Definition at line 152 of file qgridlayout.cpp.

152  {
153  if (index < things.count())
154  return things.at(index)->item();
155  else
156  return 0;
157  }
QList< QGridBox * > things
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
quint16 index
QLayoutItem * item()
Definition: qgridlayout.cpp:87

◆ maximumSize()

QSize QGridLayoutPrivate::maximumSize ( int  hSpacing,
int  vSpacing 
) const

Definition at line 470 of file qgridlayout.cpp.

471 {
472  return findSize(&QLayoutStruct::maximumSize, hSpacing, vSpacing);
473 }
QSize findSize(int QLayoutStruct::*, int hSpacing, int vSpacing) const

◆ minimumHeightForWidth()

int QGridLayoutPrivate::minimumHeightForWidth ( int  width,
int  hSpacing,
int  vSpacing 
)

Definition at line 415 of file qgridlayout.cpp.

Referenced by QGridLayout::minimumHeightForWidth().

416 {
417  (void)heightForWidth(w, hSpacing, vSpacing);
418  if (!has_hfw)
419  return -1;
420  int top, bottom;
421  effectiveMargins(0, &top, 0, &bottom);
422  return hfw_minheight + top + bottom;
423 }
void effectiveMargins(int *left, int *top, int *right, int *bottom) const
int heightForWidth(int width, int hSpacing, int vSpacing)

◆ minimumSize()

QSize QGridLayoutPrivate::minimumSize ( int  hSpacing,
int  vSpacing 
) const

Definition at line 475 of file qgridlayout.cpp.

476 {
477  return findSize(&QLayoutStruct::minimumSize, hSpacing, vSpacing);
478 }
QSize findSize(int QLayoutStruct::*, int hSpacing, int vSpacing) const

◆ numCols()

int QGridLayoutPrivate::numCols ( ) const
inline

Definition at line 123 of file qgridlayout.cpp.

123 { return cc; }

◆ numRows()

int QGridLayoutPrivate::numRows ( ) const
inline

Definition at line 122 of file qgridlayout.cpp.

122 { return rr; }

◆ recalcHFW()

void QGridLayoutPrivate::recalcHFW ( int  w)
private

Definition at line 375 of file qgridlayout.cpp.

376 {
377  /*
378  Go through all children, using colData and heightForWidth()
379  and put the results in hfwData.
380  */
381  if (!hfwData)
385 
386  int h = 0;
387  int mh = 0;
388  for (int r = 0; r < rr; r++) {
389  int spacing = rData.at(r).spacing;
390  h += rData.at(r).sizeHint + spacing;
391  mh += rData.at(r).minimumSize + spacing;
392  }
393 
394  hfw_width = w;
397 }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
QVector< QLayoutStruct > * hfwData
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
static const int QLAYOUTSIZE_MAX
Definition: qlayoutitem.h:56

◆ rowSpacing()

int QGridLayoutPrivate::rowSpacing ( int  r) const
inline

Definition at line 136 of file qgridlayout.cpp.

136 { return rMinHeights.at(r); }
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< int > rMinHeights

◆ rowStretch()

int QGridLayoutPrivate::rowStretch ( int  r) const
inline

Definition at line 130 of file qgridlayout.cpp.

130 { return rStretch.at(r); }
QVector< int > rStretch
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350

◆ setColStretch()

void QGridLayoutPrivate::setColStretch ( int  c,
int  s 
)
inline

Definition at line 128 of file qgridlayout.cpp.

129  { expand(0, c + 1); cStretch[c] = s; setDirty(); }
unsigned char c[8]
Definition: qnumeric_p.h:62
void expand(int rows, int cols)
QVector< int > cStretch

◆ setColumnMinimumWidth()

void QGridLayoutPrivate::setColumnMinimumWidth ( int  c,
int  s 
)
inline

Definition at line 134 of file qgridlayout.cpp.

135  { expand(0, c + 1); cMinWidths[c] = s; setDirty(); }
unsigned char c[8]
Definition: qnumeric_p.h:62
void expand(int rows, int cols)
QVector< int > cMinWidths

◆ setDirty()

void QGridLayoutPrivate::setDirty ( )
inline

Definition at line 142 of file qgridlayout.cpp.

142 { needRecalc = true; hfw_width = -1; }

◆ setNextPosAfter()

void QGridLayoutPrivate::setNextPosAfter ( int  r,
int  c 
)
private

Definition at line 520 of file qgridlayout.cpp.

521 {
522  if (addVertical) {
523  if (col > nextC || (col == nextC && row >= nextR)) {
524  nextR = row + 1;
525  nextC = col;
526  if (nextR >= rr) {
527  nextR = 0;
528  nextC++;
529  }
530  }
531  } else {
532  if (row > nextR || (row == nextR && col >= nextC)) {
533  nextR = row;
534  nextC = col + 1;
535  if (nextC >= cc) {
536  nextC = 0;
537  nextR++;
538  }
539  }
540  }
541 }

◆ setReversed()

void QGridLayoutPrivate::setReversed ( bool  r,
bool  c 
)
inline

Definition at line 139 of file qgridlayout.cpp.

139 { hReversed = c; vReversed = r; }
unsigned char c[8]
Definition: qnumeric_p.h:62

◆ setRowMinimumHeight()

void QGridLayoutPrivate::setRowMinimumHeight ( int  r,
int  s 
)
inline

Definition at line 132 of file qgridlayout.cpp.

133  { expand(r + 1, 0); rMinHeights[r] = s; setDirty(); }
void expand(int rows, int cols)
QVector< int > rMinHeights

◆ setRowStretch()

void QGridLayoutPrivate::setRowStretch ( int  r,
int  s 
)
inline

Definition at line 126 of file qgridlayout.cpp.

127  { expand(r + 1, 0); rStretch[r] = s; setDirty(); }
QVector< int > rStretch
void expand(int rows, int cols)

◆ setSize()

void QGridLayoutPrivate::setSize ( int  rows,
int  cols 
)
private

Definition at line 480 of file qgridlayout.cpp.

481 {
482  if ((int)rowData.size() < r) {
483  int newR = qMax(r, rr * 2);
484  rowData.resize(newR);
485  rStretch.resize(newR);
486  rMinHeights.resize(newR);
487  for (int i = rr; i < newR; i++) {
488  rowData[i].init();
489  rowData[i].maximumSize = 0;
490  rowData[i].pos = 0;
491  rowData[i].size = 0;
492  rStretch[i] = 0;
493  rMinHeights[i] = 0;
494  }
495  }
496  if ((int)colData.size() < c) {
497  int newC = qMax(c, cc * 2);
498  colData.resize(newC);
499  cStretch.resize(newC);
500  cMinWidths.resize(newC);
501  for (int i = cc; i < newC; i++) {
502  colData[i].init();
503  colData[i].maximumSize = 0;
504  colData[i].pos = 0;
505  colData[i].size = 0;
506  cStretch[i] = 0;
507  cMinWidths[i] = 0;
508  }
509  }
510 
511  if (hfwData && (int)hfwData->size() < r) {
512  delete hfwData;
513  hfwData = 0;
514  hfw_width = -1;
515  }
516  rr = r;
517  cc = c;
518 }
unsigned char c[8]
Definition: qnumeric_p.h:62
QVector< QLayoutStruct > * hfwData
QVector< QLayoutStruct > colData
QVector< int > rStretch
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
void resize(int size)
Sets the size of the vector to size.
Definition: qvector.h:342
QVector< int > cStretch
QVector< int > rMinHeights
QVector< QLayoutStruct > rowData
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
QVector< int > cMinWidths

◆ setupHfwLayoutData()

void QGridLayoutPrivate::setupHfwLayoutData ( )
private

Definition at line 874 of file qgridlayout.cpp.

875 {
877  for (int i = 0; i < rr; i++) {
878  rData[i] = rowData.at(i);
879  rData[i].minimumSize = rData[i].sizeHint = rMinHeights.at(i);
880  }
881 
882  for (int pass = 0; pass < 2; ++pass) {
883  for (int i = 0; i < things.size(); ++i) {
884  QGridBox *box = things.at(i);
885  int r1 = box->row;
886  int c1 = box->col;
887  int r2 = box->toRow(rr);
888  int c2 = box->toCol(cc);
889  int w = colData.at(c2).pos + colData.at(c2).size - colData.at(c1).pos;
890 
891  if (r1 == r2) {
892  if (pass == 0)
893  addHfwData(box, w);
894  } else {
895  if (pass == 0) {
896  initEmptyMultiBox(rData, r1, r2);
897  } else {
898  QSize hint = box->sizeHint();
899  QSize min = box->minimumSize();
900  if (box->hasHeightForWidth()) {
901  int hfwh = box->heightForWidth(w);
902  if (hfwh > hint.height())
903  hint.setHeight(hfwh);
904  if (hfwh > min.height())
905  min.setHeight(hfwh);
906  }
907  distributeMultiBox(rData, r1, r2, min.height(), hint.height(),
908  rStretch, box->vStretch());
909  }
910  }
911  }
912  }
913  for (int i = 0; i < rr; i++)
914  rData[i].expansive = rData.at(i).expansive || rData.at(i).stretch > 0;
915 }
QList< QGridBox * > things
int heightForWidth(int w) const
Definition: qgridlayout.cpp:82
static void initEmptyMultiBox(QVector< QLayoutStruct > &chain, int start, int end)
QVector< QLayoutStruct > * hfwData
QVector< QLayoutStruct > colData
QVector< int > rStretch
void setHeight(int h)
Sets the height to the given height.
Definition: qsize.h:135
int vStretch()
Definition: qgridlayout.cpp:92
QSize minimumSize() const
Definition: qgridlayout.cpp:76
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int toRow(int rr) const
Definition: qgridlayout.cpp:99
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QVector< int > rMinHeights
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
int height() const
Returns the height.
Definition: qsize.h:129
int toCol(int cc) const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void addHfwData(QGridBox *box, int width)
QVector< QLayoutStruct > rowData
QSize sizeHint() const
Definition: qgridlayout.cpp:75
static void distributeMultiBox(QVector< QLayoutStruct > &chain, int start, int end, int minSize, int sizeHint, QVector< int > &stretchArray, int stretch)
bool hasHeightForWidth() const
Definition: qgridlayout.cpp:81

◆ setupLayoutData()

void QGridLayoutPrivate::setupLayoutData ( int  hSpacing,
int  vSpacing 
)
private

Definition at line 757 of file qgridlayout.cpp.

Referenced by expandingDirections(), and findSize().

758 {
759  Q_Q(QGridLayout);
760 
761 #ifndef QT_LAYOUT_DISABLE_CACHING
762  if (!needRecalc)
763  return;
764 #endif
765  has_hfw = false;
766  int i;
767 
768  for (i = 0; i < rr; i++) {
769  rowData[i].init(rStretch.at(i), rMinHeights.at(i));
770  rowData[i].maximumSize = rStretch.at(i) ? QLAYOUTSIZE_MAX : rMinHeights.at(i);
771  }
772  for (i = 0; i < cc; i++) {
773  colData[i].init(cStretch.at(i), cMinWidths.at(i));
774  colData[i].maximumSize = cStretch.at(i) ? QLAYOUTSIZE_MAX : cMinWidths.at(i);
775  }
776 
777  int n = things.size();
779 
780  bool has_multi = false;
781 
782  /*
783  Grid of items. We use it to determine which items are
784  adjacent to which and compute the spacings correctly.
785  */
786  QVarLengthArray<QGridBox *> grid(rr * cc);
787  qMemSet(grid.data(), 0, rr * cc * sizeof(QGridBox *));
788 
789  /*
790  Initialize 'sizes' and 'grid' data structures, and insert
791  non-spanning items to our row and column data structures.
792  */
793  for (i = 0; i < n; ++i) {
794  QGridBox * const box = things.at(i);
795  sizes[i].minS = box->minimumSize();
796  sizes[i].hint = box->sizeHint();
797  sizes[i].maxS = box->maximumSize();
798 
799  if (box->hasHeightForWidth())
800  has_hfw = true;
801 
802  if (box->row == box->toRow(rr)) {
803  addData(box, sizes[i], true, false);
804  } else {
805  initEmptyMultiBox(rowData, box->row, box->toRow(rr));
806  has_multi = true;
807  }
808 
809  if (box->col == box->toCol(cc)) {
810  addData(box, sizes[i], false, true);
811  } else {
812  initEmptyMultiBox(colData, box->col, box->toCol(cc));
813  has_multi = true;
814  }
815 
816  for (int r = box->row; r <= box->toRow(rr); ++r) {
817  for (int c = box->col; c <= box->toCol(cc); ++c) {
818  gridAt(grid.data(), r, c, cc) = box;
819  }
820  }
821  }
822 
823  setupSpacings(colData, grid.data(), hSpacing, Qt::Horizontal);
824  setupSpacings(rowData, grid.data(), vSpacing, Qt::Vertical);
825 
826  /*
827  Insert multicell items to our row and column data structures.
828  This must be done after the non-spanning items to obtain a
829  better distribution in distributeMultiBox().
830  */
831  if (has_multi) {
832  for (i = 0; i < n; ++i) {
833  QGridBox * const box = things.at(i);
834 
835  if (box->row != box->toRow(rr))
836  distributeMultiBox(rowData, box->row, box->toRow(rr), sizes[i].minS.height(),
837  sizes[i].hint.height(), rStretch, box->vStretch());
838  if (box->col != box->toCol(cc))
839  distributeMultiBox(colData, box->col, box->toCol(cc), sizes[i].minS.width(),
840  sizes[i].hint.width(), cStretch, box->hStretch());
841  }
842  }
843 
844  for (i = 0; i < rr; i++)
845  rowData[i].expansive = rowData.at(i).expansive || rowData.at(i).stretch > 0;
846  for (i = 0; i < cc; i++)
847  colData[i].expansive = colData.at(i).expansive || colData.at(i).stretch > 0;
848 
849  q->getContentsMargins(&leftMargin, &topMargin, &rightMargin, &bottomMargin);
850 
851  needRecalc = false;
852 }
QList< QGridBox * > things
unsigned char c[8]
Definition: qnumeric_p.h:62
static void initEmptyMultiBox(QVector< QLayoutStruct > &chain, int start, int end)
void addData(QGridBox *b, const QGridLayoutSizeTriple &sizes, bool r, bool c)
QVector< QLayoutStruct > colData
QVector< int > rStretch
#define Q_Q(Class)
Definition: qglobal.h:2483
int vStretch()
Definition: qgridlayout.cpp:92
void setupSpacings(QVector< QLayoutStruct > &chain, QGridBox *grid[], int fixedSpacing, Qt::Orientation orientation)
QSize minimumSize() const
Definition: qgridlayout.cpp:76
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QSize maximumSize() const
Definition: qgridlayout.cpp:77
int toRow(int rr) const
Definition: qgridlayout.cpp:99
QVector< int > cStretch
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
int hStretch()
Definition: qgridlayout.cpp:90
QVector< int > rMinHeights
void * qMemSet(void *dest, int c, size_t n)
Definition: qglobal.cpp:2509
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
static QGridBox *& gridAt(QGridBox *grid[], int r, int c, int cc, Qt::Orientation orientation=Qt::Vertical)
int toCol(int cc) const
T * data()
Returns a pointer to the data stored in the vector.
Definition: qvector.h:152
QVector< QLayoutStruct > rowData
QSize sizeHint() const
Definition: qgridlayout.cpp:75
static const int QLAYOUTSIZE_MAX
Definition: qlayoutitem.h:56
static void distributeMultiBox(QVector< QLayoutStruct > &chain, int start, int end, int minSize, int sizeHint, QVector< int > &stretchArray, int stretch)
bool hasHeightForWidth() const
Definition: qgridlayout.cpp:81
QVector< int > cMinWidths

◆ setupSpacings()

void QGridLayoutPrivate::setupSpacings ( QVector< QLayoutStruct > &  chain,
QGridBox grid[],
int  fixedSpacing,
Qt::Orientation  orientation 
)
private

Definition at line 690 of file qgridlayout.cpp.

693 {
694  Q_Q(QGridLayout);
695  int numRows = rr; // or columns if orientation is horizontal
696  int numColumns = cc; // or rows if orientation is horizontal
697 
698  if (orientation == Qt::Horizontal) {
699  qSwap(numRows, numColumns);
700  }
701 
702  QStyle *style = 0;
703  if (fixedSpacing < 0) {
704  if (QWidget *parentWidget = q->parentWidget())
705  style = parentWidget->style();
706  }
707 
708  for (int c = 0; c < numColumns; ++c) {
709  QGridBox *previousBox = 0;
710  int previousRow = -1; // previous *non-empty* row
711 
712  for (int r = 0; r < numRows; ++r) {
713  if (chain.at(r).empty)
714  continue;
715 
716  QGridBox *box = gridAt(grid, r, c, cc, orientation);
717  if (previousRow != -1 && (!box || previousBox != box)) {
718  int spacing = fixedSpacing;
719  if (spacing < 0) {
720  QSizePolicy::ControlTypes controlTypes1 = QSizePolicy::DefaultType;
721  QSizePolicy::ControlTypes controlTypes2 = QSizePolicy::DefaultType;
722  if (previousBox)
723  controlTypes1 = previousBox->item()->controlTypes();
724  if (box)
725  controlTypes2 = box->item()->controlTypes();
726 
727  if ((orientation == Qt::Horizontal && hReversed)
728  || (orientation == Qt::Vertical && vReversed))
729  qSwap(controlTypes1, controlTypes2);
730 
731  if (style)
732  spacing = style->combinedLayoutSpacing(controlTypes1, controlTypes2,
733  orientation, 0, q->parentWidget());
734  } else {
735  if (orientation == Qt::Vertical) {
736  QGridBox *sibling = vReversed ? previousBox : box;
737  if (sibling) {
738  QWidget *wid = sibling->item()->widget();
739  if (wid)
740  spacing = qMax(spacing, sibling->item()->geometry().top() - wid->geometry().top() );
741  }
742  }
743  }
744 
745  if (spacing > chain.at(previousRow).spacing)
746  chain[previousRow].spacing = spacing;
747  }
748 
749  previousBox = box;
750  previousRow = r;
751  }
752  }
753 }
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
unsigned char c[8]
Definition: qnumeric_p.h:62
virtual QRect geometry() const =0
Returns the rectangle covered by this layout item.
int numRows() const
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
QSizePolicy::ControlTypes controlTypes() const
Returns the control type(s) for the layout item.
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QStyle * style() const
Definition: qwidget.cpp:2742
#define Q_Q(Class)
Definition: qglobal.h:2483
void qSwap(T &value1, T &value2)
Definition: qglobal.h:2181
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
static QWidget * parentWidget(const QWidget *w)
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
Definition: qstyle.h:68
static QGridBox *& gridAt(QGridBox *grid[], int r, int c, int cc, Qt::Orientation orientation=Qt::Vertical)
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
QLayoutItem * item()
Definition: qgridlayout.cpp:87
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition: qwidget.h:158
int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option=0, QWidget *widget=0) const
Returns the spacing that should be used between controls1 and controls2 in a layout.
Definition: qstyle.cpp:2438

◆ sizeHint()

QSize QGridLayoutPrivate::sizeHint ( int  hSpacing,
int  vSpacing 
) const

Definition at line 465 of file qgridlayout.cpp.

466 {
467  return findSize(&QLayoutStruct::sizeHint, hSpacing, vSpacing);
468 }
QSize findSize(int QLayoutStruct::*, int hSpacing, int vSpacing) const

◆ takeAt()

QLayoutItem* QGridLayoutPrivate::takeAt ( int  index)
inline

Definition at line 158 of file qgridlayout.cpp.

158  {
159  Q_Q(QGridLayout);
160  if (index < things.count()) {
161  if (QGridBox *b = things.takeAt(index)) {
162  QLayoutItem *item = b->takeItem();
163  if (QLayout *l = item->layout()) {
164  // sanity check in case the user passed something weird to QObject::setParent()
165  if (l->parent() == q)
166  l->setParent(0);
167  }
168  delete b;
169  return item;
170  }
171  }
172  return 0;
173  }
QList< QGridBox * > things
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
#define Q_Q(Class)
Definition: qglobal.h:2483
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
The QLayout class is the base class of geometry managers.
Definition: qlayout.h:90
virtual QLayout * layout()
If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned.
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
The QGridLayout class lays out widgets in a grid.
Definition: qgridlayout.h:60
QFactoryLoader * l
T takeAt(int i)
Removes the item at index position i and returns it.
Definition: qlist.h:484
quint16 index

◆ verReversed()

bool QGridLayoutPrivate::verReversed ( ) const
inline

Definition at line 141 of file qgridlayout.cpp.

141 { return vReversed; }

Properties

◆ addVertical

uint QGridLayoutPrivate::addVertical
private

Definition at line 230 of file qgridlayout.cpp.

◆ bottomMargin

int QGridLayoutPrivate::bottomMargin
private

Definition at line 224 of file qgridlayout.cpp.

◆ cc

int QGridLayoutPrivate::cc
private

Definition at line 203 of file qgridlayout.cpp.

◆ cMinWidths

QVector<int> QGridLayoutPrivate::cMinWidths
private

Definition at line 210 of file qgridlayout.cpp.

◆ colData

QVector<QLayoutStruct> QGridLayoutPrivate::colData
private

Definition at line 205 of file qgridlayout.cpp.

◆ cStretch

QVector<int> QGridLayoutPrivate::cStretch
private

Definition at line 208 of file qgridlayout.cpp.

◆ has_hfw

uint QGridLayoutPrivate::has_hfw
private

Definition at line 229 of file qgridlayout.cpp.

◆ hfw_height

int QGridLayoutPrivate::hfw_height
private

Definition at line 214 of file qgridlayout.cpp.

◆ hfw_minheight

int QGridLayoutPrivate::hfw_minheight
private

Definition at line 215 of file qgridlayout.cpp.

◆ hfw_width

int QGridLayoutPrivate::hfw_width
private

Definition at line 213 of file qgridlayout.cpp.

◆ hfwData

QVector<QLayoutStruct>* QGridLayoutPrivate::hfwData
private

Definition at line 206 of file qgridlayout.cpp.

◆ horizontalSpacing

int QGridLayoutPrivate::horizontalSpacing
private

Definition at line 219 of file qgridlayout.cpp.

◆ hReversed

uint QGridLayoutPrivate::hReversed
private

Definition at line 226 of file qgridlayout.cpp.

◆ leftMargin

int QGridLayoutPrivate::leftMargin
private

Definition at line 221 of file qgridlayout.cpp.

◆ needRecalc

uint QGridLayoutPrivate::needRecalc
private

Definition at line 228 of file qgridlayout.cpp.

◆ nextC

int QGridLayoutPrivate::nextC
private

Definition at line 217 of file qgridlayout.cpp.

◆ nextR

int QGridLayoutPrivate::nextR
private

Definition at line 216 of file qgridlayout.cpp.

◆ rightMargin

int QGridLayoutPrivate::rightMargin
private

Definition at line 223 of file qgridlayout.cpp.

◆ rMinHeights

QVector<int> QGridLayoutPrivate::rMinHeights
private

Definition at line 209 of file qgridlayout.cpp.

◆ rowData

QVector<QLayoutStruct> QGridLayoutPrivate::rowData
private

Definition at line 204 of file qgridlayout.cpp.

◆ rr

int QGridLayoutPrivate::rr
private

Definition at line 202 of file qgridlayout.cpp.

◆ rStretch

QVector<int> QGridLayoutPrivate::rStretch
private

Definition at line 207 of file qgridlayout.cpp.

◆ things

QList<QGridBox *> QGridLayoutPrivate::things
private

Definition at line 211 of file qgridlayout.cpp.

◆ topMargin

int QGridLayoutPrivate::topMargin
private

Definition at line 222 of file qgridlayout.cpp.

◆ verticalSpacing

int QGridLayoutPrivate::verticalSpacing
private

Definition at line 220 of file qgridlayout.cpp.

◆ vReversed

uint QGridLayoutPrivate::vReversed
private

Definition at line 227 of file qgridlayout.cpp.


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