QBoxLayoutPrivate Class Reference

Inheritance diagram for QBoxLayoutPrivate:

Inheritance graph
[legend]
Collaboration diagram for QBoxLayoutPrivate:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 89 of file qboxlayout.cpp.

Public Member Functions

 QBoxLayoutPrivate ()
 ~QBoxLayoutPrivate ()
void setDirty ()
void deleteAll ()
void setupGeom ()
void calcHfw (int)

Public Attributes

QList< QBoxLayoutItem * > list
QVector< QLayoutStructgeomArray
int hfwWidth
int hfwHeight
int hfwMinHeight
QSize sizeHint
QSize minSize
QSize maxSize
Qt::Orientations expanding
uint hasHfw: 1
uint dirty: 1
QBoxLayout::Direction dir


Constructor & Destructor Documentation

QBoxLayoutPrivate::QBoxLayoutPrivate (  )  [inline]

Definition at line 93 of file qboxlayout.cpp.

00093 : hfwWidth(-1), dirty(true) { }

QBoxLayoutPrivate::~QBoxLayoutPrivate (  ) 

Definition at line 123 of file qboxlayout.cpp.

00124 {
00125 }


Member Function Documentation

void QBoxLayoutPrivate::setDirty (  )  [inline]

Definition at line 96 of file qboxlayout.cpp.

References QVector< T >::clear(), dirty, geomArray, hfwHeight, and hfwWidth.

00096                     {
00097         geomArray.clear();
00098         hfwWidth = -1;
00099         hfwHeight = -1;
00100         dirty = true;
00101     }

Here is the call graph for this function:

void QBoxLayoutPrivate::deleteAll (  )  [inline]

Definition at line 116 of file qboxlayout.cpp.

References QList< T >::isEmpty(), list, and QList< T >::takeFirst().

00116 { while (!list.isEmpty()) delete list.takeFirst(); }

Here is the call graph for this function:

void QBoxLayoutPrivate::setupGeom (  ) 

Definition at line 136 of file qboxlayout.cpp.

References a, QList< T >::at(), QSize::boundedTo(), QVector< T >::clear(), QList< T >::count(), dir, dirty, qdesigner_internal::expand(), QSize::expandedTo(), expanding, geomArray, hasHfw, QSize::height(), Qt::Horizontal, horz(), i, QSize::isEmpty(), QBoxLayoutItem::item, list, QLayoutItem::maximumSize(), maxSize, minSize, n, QLAYOUTSIZE_MAX, qMax(), qMaxExpCalc(), sizeHint, Qt::Vertical, and QSize::width().

00137 {
00138     if (!dirty)
00139         return;
00140 
00141     Q_Q(QBoxLayout);
00142     int maxw = horz(dir) ? 0 : QLAYOUTSIZE_MAX;
00143     int maxh = horz(dir) ? QLAYOUTSIZE_MAX : 0;
00144     int minw = 0;
00145     int minh = 0;
00146     int hintw = 0;
00147     int hinth = 0;
00148 
00149     bool horexp = false;
00150     bool verexp = false;
00151 
00152     hasHfw = false;
00153 
00154     int n = list.count();
00155     geomArray.clear();
00156     QVector<QLayoutStruct> a(n);
00157 
00158     bool first = true; // empty so far?
00159     for (int i = 0; i < n; i++) {
00160         QBoxLayoutItem *box = list.at(i);
00161         QSize max = box->item->maximumSize();
00162         QSize min = box->item->minimumSize();
00163         QSize hint = box->item->sizeHint();
00164         Qt::Orientations exp = box->item->expandingDirections();
00165         bool empty = box->item->isEmpty();
00166         // space before non-empties, except the first:
00167         int space = (empty || first) ? 0 : q->spacing();
00168         bool ignore = empty && box->item->widget(); // ignore hidden widgets
00169         if (horz(dir)) {
00170             bool expand = exp & Qt::Horizontal || box->stretch > 0;
00171             horexp = horexp || expand;
00172             maxw += max.width() + space;
00173             minw += min.width() + space;
00174             hintw += hint.width() + space;
00175             if (!ignore)
00176                 qMaxExpCalc(maxh, verexp, first,
00177                             max.height(), exp & Qt::Vertical, box->item->isEmpty());
00178             minh = qMax(minh, min.height());
00179             hinth = qMax(hinth, hint.height());
00180 
00181             a[i].sizeHint = hint.width();
00182             a[i].maximumSize = max.width();
00183             a[i].minimumSize = min.width();
00184             a[i].expansive = expand;
00185             a[i].stretch = box->stretch ? box->stretch : box->hStretch();
00186         } else {
00187             bool expand = (exp & Qt::Vertical || box->stretch > 0);
00188             verexp = verexp || expand;
00189             maxh += max.height() + space;
00190             minh += min.height() + space;
00191             hinth += hint.height() + space;
00192             if (!ignore)
00193                 qMaxExpCalc(maxw, horexp, first,
00194                              max.width(), exp & Qt::Horizontal, box->item->isEmpty());
00195             minw = qMax(minw, min.width());
00196             hintw = qMax(hintw, hint.width());
00197 
00198             a[i].sizeHint = hint.height();
00199             a[i].maximumSize = max.height();
00200             a[i].minimumSize = min.height();
00201             a[i].expansive = expand;
00202             a[i].stretch = box->stretch ? box->stretch : box->vStretch();
00203         }
00204 
00205         a[i].empty = empty;
00206         hasHfw = hasHfw || box->item->hasHeightForWidth();
00207     }
00208     geomArray = a;
00209 
00210     expanding = (Qt::Orientations)
00211                        ((horexp ? Qt::Horizontal : 0)
00212                          | (verexp ? Qt::Vertical : 0));
00213 
00214     minSize = QSize(minw, minh);
00215     maxSize = QSize(maxw, maxh).expandedTo(minSize);
00216     sizeHint = QSize(hintw, hinth)
00217                      .expandedTo(minSize)
00218                      .boundedTo(maxSize);
00219 
00220     dirty = false;
00221 }

Here is the call graph for this function:

void QBoxLayoutPrivate::calcHfw ( int   ) 

Definition at line 226 of file qboxlayout.cpp.

References a, QList< T >::at(), dir, geomArray, h, hfwHeight, hfwMinHeight, hfwWidth, horz(), i, QLayoutItem::isEmpty(), QBoxLayoutItem::item, list, n, qGeomCalc(), qMax(), and QList< T >::size().

00227 {
00228     Q_Q(QBoxLayout);
00229     int h = 0;
00230     int mh = 0;
00231 
00232     if (horz(dir)) {
00233         QVector<QLayoutStruct> &a = geomArray;
00234         int n = a.count();
00235         qGeomCalc(a, 0, n, 0, w, q->spacing());
00236         for (int i = 0; i < n; i++) {
00237             QBoxLayoutItem *box = list.at(i);
00238             h = qMax(h, box->hfw(a[i].size));
00239             mh = qMax(mh, box->mhfw(a[i].size));
00240         }
00241     } else {
00242         bool first = true;
00243         for (int i = 0; i < list.size(); ++i) {
00244             QBoxLayoutItem *box = list.at(i);
00245             bool empty = box->item->isEmpty();
00246             h += box->hfw(w);
00247             mh += box->mhfw(w);
00248             if (!first && !empty) {
00249                 h += q->spacing();
00250                 mh += q->spacing();
00251             }
00252             first = first && empty;
00253         }
00254     }
00255     hfwWidth = w;
00256     hfwHeight = h;
00257     hfwMinHeight = mh;
00258 }

Here is the call graph for this function:


Member Data Documentation

QList<QBoxLayoutItem *> QBoxLayoutPrivate::list

Definition at line 103 of file qboxlayout.cpp.

Referenced by calcHfw(), deleteAll(), and setupGeom().

QVector<QLayoutStruct> QBoxLayoutPrivate::geomArray

Definition at line 104 of file qboxlayout.cpp.

Referenced by calcHfw(), setDirty(), and setupGeom().

int QBoxLayoutPrivate::hfwWidth

Definition at line 105 of file qboxlayout.cpp.

Referenced by calcHfw(), and setDirty().

int QBoxLayoutPrivate::hfwHeight

Definition at line 106 of file qboxlayout.cpp.

Referenced by calcHfw(), and setDirty().

int QBoxLayoutPrivate::hfwMinHeight

Definition at line 107 of file qboxlayout.cpp.

Referenced by calcHfw().

QSize QBoxLayoutPrivate::sizeHint

Definition at line 108 of file qboxlayout.cpp.

Referenced by setupGeom().

QSize QBoxLayoutPrivate::minSize

Definition at line 109 of file qboxlayout.cpp.

Referenced by setupGeom().

QSize QBoxLayoutPrivate::maxSize

Definition at line 110 of file qboxlayout.cpp.

Referenced by setupGeom().

Qt::Orientations QBoxLayoutPrivate::expanding

Definition at line 111 of file qboxlayout.cpp.

Referenced by setupGeom().

uint QBoxLayoutPrivate::hasHfw

Definition at line 112 of file qboxlayout.cpp.

Referenced by setupGeom().

uint QBoxLayoutPrivate::dirty

Definition at line 113 of file qboxlayout.cpp.

Referenced by setDirty(), and setupGeom().

QBoxLayout::Direction QBoxLayoutPrivate::dir

Definition at line 114 of file qboxlayout.cpp.

Referenced by calcHfw(), and setupGeom().


The documentation for this class was generated from the following file:
Generated on Thu Mar 15 16:53:11 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1