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

#include <qtoolbararealayout_p.h>

Public Functions

void clear ()
 
int distance (const QPoint &pos) const
 
void fitLayout ()
 
QList< int > gapIndex (const QPoint &pos, int *maxDistance) const
 
bool insertGap (const QList< int > &path, QLayoutItem *item)
 
void insertItem (QToolBar *before, QLayoutItem *item)
 
QLayoutIteminsertToolBar (QToolBar *before, QToolBar *toolBar)
 
void insertToolBarBreak (QToolBar *before)
 
QRect itemRect (const QList< int > &path) const
 
QSize minimumSize () const
 
void moveToolBar (QToolBar *toolbar, int pos)
 
 QToolBarAreaLayoutInfo (QInternal::DockPosition pos=QInternal::TopDock)
 
void removeToolBar (QToolBar *toolBar)
 
void removeToolBarBreak (QToolBar *before)
 
QSize sizeHint () const
 

Public Variables

bool dirty
 
QInternal::DockPosition dockPos
 
QList< QToolBarAreaLayoutLinelines
 
Qt::Orientation o
 
QRect rect
 

Detailed Description

Definition at line 155 of file qtoolbararealayout_p.h.

Constructors and Destructors

◆ QToolBarAreaLayoutInfo()

QToolBarAreaLayoutInfo::QToolBarAreaLayoutInfo ( QInternal::DockPosition  pos = QInternal::TopDock)

Definition at line 205 of file qtoolbararealayout.cpp.

206  : dockPos(pos), dirty(false)
207 {
208  switch (pos) {
209  case QInternal::LeftDock:
211  o = Qt::Vertical;
212  break;
213  case QInternal::TopDock:
215  o = Qt::Horizontal;
216  break;
217  default:
218  o = Qt::Horizontal;
219  break;
220  }
221 }
QInternal::DockPosition dockPos

Functions

◆ clear()

void QToolBarAreaLayoutInfo::clear ( )

Definition at line 572 of file qtoolbararealayout.cpp.

573 {
574  lines.clear();
575  rect = QRect();
576 }
QList< QToolBarAreaLayoutLine > lines
void clear()
Removes all items from the list.
Definition: qlist.h:764
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58

◆ distance()

int QToolBarAreaLayoutInfo::distance ( const QPoint pos) const

Definition at line 600 of file qtoolbararealayout.cpp.

Referenced by gapIndex().

601 {
602  switch (dockPos) {
603  case QInternal::LeftDock:
604  if (pos.y() < rect.bottom())
605  return pos.x() - rect.right();
607  if (pos.y() < rect.bottom())
608  return rect.left() - pos.x();
609  case QInternal::TopDock:
610  if (pos.x() < rect.right())
611  return pos.y() - rect.bottom();
613  if (pos.x() < rect.right())
614  return rect.top() - pos.y();
615  default:
616  break;
617  }
618  return -1;
619 }
QInternal::DockPosition dockPos
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
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
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128

◆ fitLayout()

void QToolBarAreaLayoutInfo::fitLayout ( )

Definition at line 263 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::fitLayout(), and moveToolBar().

264 {
265  dirty = false;
266 
267  int b = 0;
268 
270 
271  int i = reverse ? lines.count() - 1 : 0;
272  for (;;) {
273  if ((reverse && i < 0) || (!reverse && i == lines.count()))
274  break;
275 
277  if (!l.skip()) {
278  if (o == Qt::Horizontal) {
279  l.rect.setLeft(rect.left());
280  l.rect.setRight(rect.right());
281  l.rect.setTop(b + rect.top());
282  b += l.sizeHint().height();
283  l.rect.setBottom(b - 1 + rect.top());
284  } else {
285  l.rect.setTop(rect.top());
286  l.rect.setBottom(rect.bottom());
287  l.rect.setLeft(b + rect.left());
288  b += l.sizeHint().width();
289  l.rect.setRight(b - 1 + rect.left());
290  }
291 
292  l.fitLayout();
293  }
294 
295  i += reverse ? -1 : 1;
296  }
297 }
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Definition: qrect.h:267
QList< QToolBarAreaLayoutLine > lines
QInternal::DockPosition dockPos
static C reverse(const C &l)
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
int width() const
Returns the width.
Definition: qsize.h:126
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:261
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
Definition: qrect.h:264
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
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:258
int height() const
Returns the height.
Definition: qsize.h:129
QFactoryLoader * l

◆ gapIndex()

QList< int > QToolBarAreaLayoutInfo::gapIndex ( const QPoint pos,
int *  maxDistance 
) const

Definition at line 486 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::gapIndex().

487 {
488  int p = pick(o, pos);
489 
490  if (rect.contains(pos)) {
491  for (int j = 0; j < lines.count(); ++j) {
492  const QToolBarAreaLayoutLine &line = lines.at(j);
493  if (line.skip())
494  continue;
495  if (!line.rect.contains(pos))
496  continue;
497 
498  int k = 0;
499  for (; k < line.toolBarItems.count(); ++k) {
500  const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
501  if (item.skip())
502  continue;
503 
504  int size = qMin(item.size, pick(o, item.sizeHint()));
505 
506  if (p > item.pos + size)
507  continue;
508  if (p > item.pos + size/2)
509  ++k;
510  break;
511  }
512 
513  QList<int> result;
514  result << j << k;
515  *minDistance = 0; //we found a perfect match
516  return result;
517  }
518  } else {
519  const int dist = distance(pos);
520  //it will only return a path if the minDistance is higher than the current distance
521  if (dist >= 0 && *minDistance > dist) {
522  *minDistance = dist;
523 
524  QList<int> result;
525  result << lines.count() << 0;
526  return result;
527  }
528  }
529 
530  return QList<int>();
531 }
QList< QToolBarAreaLayoutLine > lines
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
int distance(const QPoint &pos) const
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
Definition: qrect.cpp:1101
QList< QToolBarAreaLayoutItem > toolBarItems
static int pick(bool vertical, const QSize &size)

◆ insertGap()

bool QToolBarAreaLayoutInfo::insertGap ( const QList< int > &  path,
QLayoutItem item 
)

Definition at line 533 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::insertGap().

534 {
535  Q_ASSERT(path.count() == 2);
536  int j = path.first();
537  if (j == lines.count())
539 
540  QToolBarAreaLayoutLine &line = lines[j];
541  const int k = path.at(1);
542 
543  QToolBarAreaLayoutItem gap_item;
544  gap_item.gap = true;
545  gap_item.widgetItem = item;
546 
547  //update the previous item's preferred size
548  for(int p = k - 1 ; p >= 0; --p) {
549  QToolBarAreaLayoutItem &previous = line.toolBarItems[p];
550  if (!previous.skip()) {
551  //we found the previous one
552  int previousSizeHint = pick(line.o, previous.sizeHint());
553  int previousExtraSpace = previous.size - previousSizeHint;
554 
555  if (previousExtraSpace > 0) {
556  //in this case we reset the space
557  previous.preferredSize = -1;
558  previous.size = previousSizeHint;
559 
560  gap_item.resize(o, previousExtraSpace);
561  }
562 
563  break;
564  }
565  }
566 
567  line.toolBarItems.insert(k, gap_item);
568  return true;
569 
570 }
QList< QToolBarAreaLayoutLine > lines
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
T & first()
Returns a reference to the first item in the list.
Definition: qlist.h:282
void resize(Qt::Orientation o, int newSize)
QList< QToolBarAreaLayoutItem > toolBarItems
static int pick(bool vertical, const QSize &size)

◆ insertItem()

void QToolBarAreaLayoutInfo::insertItem ( QToolBar before,
QLayoutItem item 
)

Definition at line 307 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::insertItem(), and insertToolBar().

308 {
309  if (before == 0) {
310  if (lines.isEmpty())
312  lines.last().toolBarItems.append(item);
313  return;
314  }
315 
316  for (int j = 0; j < lines.count(); ++j) {
317  QToolBarAreaLayoutLine &line = lines[j];
318 
319  for (int k = 0; k < line.toolBarItems.count(); ++k) {
320  if (line.toolBarItems.at(k).widgetItem->widget() == before) {
321  line.toolBarItems.insert(k, item);
322  return;
323  }
324  }
325  }
326 }
QList< QToolBarAreaLayoutLine > lines
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
T & last()
Returns a reference to the last item in the list.
Definition: qlist.h:284
QList< QToolBarAreaLayoutItem > toolBarItems
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.

◆ insertToolBar()

QLayoutItem * QToolBarAreaLayoutInfo::insertToolBar ( QToolBar before,
QToolBar toolBar 
)

Definition at line 299 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::addToolBar(), QToolBarAreaLayout::insertToolBar(), and QMainWindowLayoutState::restoreState().

300 {
301  toolBar->setOrientation(o);
302  QLayoutItem *item = new QWidgetItemV2(toolBar);
303  insertItem(before, item);
304  return item;
305 }
void setOrientation(Qt::Orientation orientation)
Definition: qtoolbar.cpp:750
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
void insertItem(QToolBar *before, QLayoutItem *item)

◆ insertToolBarBreak()

void QToolBarAreaLayoutInfo::insertToolBarBreak ( QToolBar before)

Definition at line 349 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::addToolBarBreak(), and QToolBarAreaLayout::insertToolBarBreak().

350 {
351  if (before == 0) {
352  if (!lines.isEmpty() && lines.last().toolBarItems.isEmpty())
353  return;
355  return;
356  }
357 
358  for (int j = 0; j < lines.count(); ++j) {
359  QToolBarAreaLayoutLine &line = lines[j];
360 
361  for (int k = 0; k < line.toolBarItems.count(); ++k) {
362  if (line.toolBarItems.at(k).widgetItem->widget() == before) {
363  if (k == 0)
364  return;
365 
366  QToolBarAreaLayoutLine newLine(o);
367  newLine.toolBarItems = line.toolBarItems.mid(k);
368  line.toolBarItems = line.toolBarItems.mid(0, k);
369  lines.insert(j + 1, newLine);
370 
371  return;
372  }
373  }
374  }
375 }
QList< QToolBarAreaLayoutLine > lines
void insert(int i, const T &t)
Inserts value at index position i in the list.
Definition: qlist.h:575
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QList< T > mid(int pos, int length=-1) const
Returns a list whose elements are copied from this list, starting at position pos.
Definition: qlist.h:637
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
T & last()
Returns a reference to the last item in the list.
Definition: qlist.h:284
QList< QToolBarAreaLayoutItem > toolBarItems
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.

◆ itemRect()

QRect QToolBarAreaLayoutInfo::itemRect ( const QList< int > &  path) const

Definition at line 578 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::itemRect().

579 {
580  Q_ASSERT(path.count() == 2);
581  int j = path.at(0);
582  int k = path.at(1);
583 
584  const QToolBarAreaLayoutLine &line = lines.at(j);
585  const QToolBarAreaLayoutItem &item = line.toolBarItems.at(k);
586 
587  QRect result = line.rect;
588 
589  if (o == Qt::Horizontal) {
590  result.setLeft(item.pos + line.rect.left());
591  result.setWidth(item.size);
592  } else {
593  result.setTop(item.pos + line.rect.top());
594  result.setHeight(item.size);
595  }
596 
597  return result;
598 }
void setHeight(int h)
Sets the height of the rectangle to the given height.
Definition: qrect.h:445
QList< QToolBarAreaLayoutLine > lines
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
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
Definition: qrect.h:261
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
Definition: qrect.h:258
void setWidth(int w)
Sets the width of the rectangle to the given width.
Definition: qrect.h:442
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QList< QToolBarAreaLayoutItem > toolBarItems

◆ minimumSize()

QSize QToolBarAreaLayoutInfo::minimumSize ( ) const

Definition at line 243 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::minimumSize().

244 {
245  int a = 0, b = 0;
246  for (int i = 0; i < lines.count(); ++i) {
247  const QToolBarAreaLayoutLine &l = lines.at(i);
248  if (l.skip())
249  continue;
250 
251  QSize m = l.minimumSize();
252  a = qMax(a, pick(o, m));
253  b += perp(o, m);
254  }
255 
256  QSize result;
257  rpick(o, result) = a;
258  rperp(o, result) = b;
259 
260  return result;
261 }
QList< QToolBarAreaLayoutLine > lines
static int & rpick(Qt::Orientation o, QPoint &pos)
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static int perp(bool vertical, const QSize &size)
QFactoryLoader * l
static int pick(bool vertical, const QSize &size)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static int & rperp(Qt::Orientation o, QPoint &pos)

◆ moveToolBar()

void QToolBarAreaLayoutInfo::moveToolBar ( QToolBar toolbar,
int  pos 
)

at this point we need to get extra pixels from the toolbars at the left

Definition at line 398 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::moveToolBar().

399 {
400  if (dirty)
401  fitLayout();
402 
403  dirty = true;
404 
405  if (o == Qt::Vertical)
406  pos -= rect.top();
407 
408  //here we actually update the preferredSize for the line containing the toolbar so that we move it
409  for (int j = 0; j < lines.count(); ++j) {
410  QToolBarAreaLayoutLine &line = lines[j];
411 
412  int previousIndex = -1;
413  int minPos = 0;
414  for (int k = 0; k < line.toolBarItems.count(); ++k) {
415  QToolBarAreaLayoutItem &current = line.toolBarItems[k];
416  if (current.widgetItem->widget() == toolbar) {
417  int newPos = current.pos;
418 
419  if (previousIndex >= 0) {
420  QToolBarAreaLayoutItem &previous = line.toolBarItems[previousIndex];
421  if (pos < current.pos) {
422  newPos = qMax(pos, minPos);
423  } else {
424  //we check the max value for the position (until everything at the right is "compressed")
425  int maxPos = pick(o, rect.size());
426  for(int l = k; l < line.toolBarItems.count(); ++l) {
427  const QToolBarAreaLayoutItem &item = line.toolBarItems.at(l);
428  if (!item.skip()) {
429  maxPos -= pick(o, item.minimumSize());
430  }
431  }
432  newPos = qMin(pos, maxPos);
433  }
434 
435  //extra is the number of pixels to add to the previous toolbar
436  int extra = newPos - current.pos;
437 
438  //we check if the previous is near its size hint
439  //in which case we try to stick to it
440  const int diff = pick(o, previous.sizeHint()) - (previous.size + extra);
441  if (qAbs(diff) < QApplication::startDragDistance()) {
442  //we stick to the default place and size
443  extra += diff;
444  }
445 
446  //update for the current item
447  current.extendSize(line.o, -extra);
448 
449  if (extra >= 0) {
450  previous.extendSize(line.o, extra);
451  } else {
452  //we need to push the toolbars on the left starting with previous
453  extra = -extra; // we just need to know the number of pixels
455  for(int l = previousIndex; l >=0; --l) {
456  QToolBarAreaLayoutItem &item = line.toolBarItems[l];
457  if (!item.skip()) {
458  const int minPreferredSize = pick(o, item.minimumSize());
459  const int margin = item.size - minPreferredSize;
460  if (margin < extra) {
461  item.resize(line.o, minPreferredSize);
462  extra -= margin;
463  } else {
464  item.extendSize(line.o, -extra);
465  extra = 0;
466  }
467  }
468  }
469  Q_ASSERT(extra == 0);
470  }
471  } else {
472  //the item is the first one, it should be at position 0
473  }
474 
475  return;
476 
477  } else if (!current.skip()) {
478  previousIndex = k;
479  minPos += pick(o, current.minimumSize());
480  }
481  }
482  }
483 }
QList< QToolBarAreaLayoutLine > lines
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
void extendSize(Qt::Orientation o, int extent)
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
NSToolbar * toolbar
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static Bigint * diff(Bigint *a, Bigint *b)
static int startDragDistance()
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
void resize(Qt::Orientation o, int newSize)
QFactoryLoader * l
QList< QToolBarAreaLayoutItem > toolBarItems
static int pick(bool vertical, const QSize &size)
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.

◆ removeToolBar()

void QToolBarAreaLayoutInfo::removeToolBar ( QToolBar toolBar)

Definition at line 328 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::removeToolBar().

329 {
330  for (int j = 0; j < lines.count(); ++j) {
331  QToolBarAreaLayoutLine &line = lines[j];
332 
333  for (int k = 0; k < line.toolBarItems.count(); ++k) {
334  QToolBarAreaLayoutItem &item = line.toolBarItems[k];
335  if (item.widgetItem->widget() == toolBar) {
336  delete item.widgetItem;
337  item.widgetItem = 0;
338  line.toolBarItems.removeAt(k);
339 
340  if (line.toolBarItems.isEmpty() && j < lines.count() - 1)
341  lines.removeAt(j);
342 
343  return;
344  }
345  }
346  }
347 }
QList< QToolBarAreaLayoutLine > lines
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
QList< QToolBarAreaLayoutItem > toolBarItems
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ removeToolBarBreak()

void QToolBarAreaLayoutInfo::removeToolBarBreak ( QToolBar before)

Definition at line 377 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::removeToolBarBreak().

378 {
379  for (int j = 0; j < lines.count(); ++j) {
380  const QToolBarAreaLayoutLine &line = lines.at(j);
381 
382  for (int k = 0; k < line.toolBarItems.count(); ++k) {
383  if (line.toolBarItems.at(k).widgetItem->widget() == before) {
384  if (k != 0)
385  return;
386  if (j == 0)
387  return;
388 
389  lines[j - 1].toolBarItems += lines[j].toolBarItems;
390  lines.removeAt(j);
391 
392  return;
393  }
394  }
395  }
396 }
QList< QToolBarAreaLayoutLine > lines
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
QList< QToolBarAreaLayoutItem > toolBarItems
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

◆ sizeHint()

QSize QToolBarAreaLayoutInfo::sizeHint ( ) const

Definition at line 223 of file qtoolbararealayout.cpp.

Referenced by QToolBarAreaLayout::fitLayout(), QToolBarAreaLayout::rectHint(), and QToolBarAreaLayout::sizeHint().

224 {
225  int a = 0, b = 0;
226  for (int i = 0; i < lines.count(); ++i) {
227  const QToolBarAreaLayoutLine &l = lines.at(i);
228  if (l.skip())
229  continue;
230 
231  QSize hint = l.sizeHint();
232  a = qMax(a, pick(o, hint));
233  b += perp(o, hint);
234  }
235 
236  QSize result;
237  rpick(o, result) = a;
238  rperp(o, result) = b;
239 
240  return result;
241 }
QList< QToolBarAreaLayoutLine > lines
static int & rpick(Qt::Orientation o, QPoint &pos)
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
static int perp(bool vertical, const QSize &size)
QFactoryLoader * l
static int pick(bool vertical, const QSize &size)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
static int & rperp(Qt::Orientation o, QPoint &pos)

Properties

◆ dirty

bool QToolBarAreaLayoutInfo::dirty

Definition at line 183 of file qtoolbararealayout_p.h.

Referenced by fitLayout(), and moveToolBar().

◆ dockPos

QInternal::DockPosition QToolBarAreaLayoutInfo::dockPos

Definition at line 182 of file qtoolbararealayout_p.h.

Referenced by distance(), and fitLayout().

◆ lines

QList<QToolBarAreaLayoutLine> QToolBarAreaLayoutInfo::lines

◆ o

Qt::Orientation QToolBarAreaLayoutInfo::o

◆ rect

QRect QToolBarAreaLayoutInfo::rect

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