Qt 4.8
Macros | Functions
qgraphicslayoutitem.cpp File Reference
#include "qglobal.h"
#include "qgraphicslayout.h"
#include "qgraphicsscene.h"
#include "qgraphicslayoutitem.h"
#include "qgraphicslayoutitem_p.h"
#include "qwidget.h"
#include "qgraphicswidget.h"
#include <QtDebug>

Go to the source code of this file.

Macros

#define COMBINE_SIZE(result, size)
 

Functions

static void boundSize (QSizeF &result, const QSizeF &size)
 
static void combineSize (QSizeF &result, const QSizeF &size)
 
static void expandSize (QSizeF &result, const QSizeF &size)
 
static void normalizeHints (qreal &minimum, qreal &preferred, qreal &maximum, qreal &descent)
 

Macro Definition Documentation

◆ COMBINE_SIZE

#define COMBINE_SIZE (   result,
  size 
)
Value:
do { \
if ((result).width() < 0 || (result).height() < 0) \
combineSize((result), (size)); \
} while (false)

Definition at line 61 of file qgraphicslayoutitem.cpp.

Referenced by QGraphicsLayoutItemPrivate::effectiveSizeHints().

Function Documentation

◆ boundSize()

static void boundSize ( QSizeF result,
const QSizeF size 
)
static

Definition at line 75 of file qgraphicslayoutitem.cpp.

Referenced by QGraphicsLayoutItemPrivate::effectiveSizeHints().

76 {
77  if (size.width() >= 0 && size.width() < result.width())
78  result.setWidth(size.width());
79  if (size.height() >= 0 && size.height() < result.height())
80  result.setHeight(size.height());
81 }
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
void setWidth(qreal w)
Sets the width to the given width.
Definition: qsize.h:290
void setHeight(qreal h)
Sets the height to the given height.
Definition: qsize.h:293

◆ combineSize()

static void combineSize ( QSizeF result,
const QSizeF size 
)
static

Definition at line 67 of file qgraphicslayoutitem.cpp.

Referenced by QGraphicsLayoutItemPrivate::effectiveSizeHints().

68 {
69  if (result.width() < 0)
70  result.setWidth(size.width());
71  if (result.height() < 0)
72  result.setHeight(size.height());
73 }
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
void setWidth(qreal w)
Sets the width to the given width.
Definition: qsize.h:290
void setHeight(qreal h)
Sets the height to the given height.
Definition: qsize.h:293

◆ expandSize()

static void expandSize ( QSizeF result,
const QSizeF size 
)
static

Definition at line 83 of file qgraphicslayoutitem.cpp.

Referenced by QGraphicsLayoutItemPrivate::effectiveSizeHints().

84 {
85  if (size.width() >= 0 && size.width() > result.width())
86  result.setWidth(size.width());
87  if (size.height() >= 0 && size.height() > result.height())
88  result.setHeight(size.height());
89 }
qreal width() const
Returns the width.
Definition: qsize.h:284
qreal height() const
Returns the height.
Definition: qsize.h:287
void setWidth(qreal w)
Sets the width to the given width.
Definition: qsize.h:290
void setHeight(qreal h)
Sets the height to the given height.
Definition: qsize.h:293

◆ normalizeHints()

static void normalizeHints ( qreal minimum,
qreal preferred,
qreal maximum,
qreal descent 
)
static

Definition at line 91 of file qgraphicslayoutitem.cpp.

Referenced by QGraphicsLayoutItemPrivate::effectiveSizeHints().

92 {
93  if (minimum >= 0 && maximum >= 0 && minimum > maximum)
94  minimum = maximum;
95 
96  if (preferred >= 0) {
97  if (minimum >= 0 && preferred < minimum) {
98  preferred = minimum;
99  } else if (maximum >= 0 && preferred > maximum) {
100  preferred = maximum;
101  }
102  }
103 
104  if (minimum >= 0 && descent > minimum)
105  descent = minimum;
106 }