42 #include "private/qdeclarativepositioners_p.h" 43 #include "private/qdeclarativepositioners_p_p.h" 50 #include <QtCore/qmath.h> 53 #include <QCoreApplication> 157 return d->moveTransition;
163 if (mt ==
d->moveTransition)
165 d->moveTransition = mt;
172 return d->addTransition;
178 if (add ==
d->addTransition)
181 d->addTransition =
add;
214 d->unwatchChanges(child);
229 if (
d->doingPositioning)
232 d->queuedPositioning =
false;
233 d->doingPositioning =
true;
240 for (
int ii = 0; ii < children.
count(); ++ii) {
247 int wIdx = oldItems.find(posItem);
249 d->watchChanges(child);
256 item = &oldItems[wIdx];
272 if(
d->addTransition ||
d->moveTransition)
274 d->doingPositioning =
false;
285 if (!
d->addTransition)
289 }
else if (x != target.
item->
x()) {
290 if (!
d->moveTransition)
303 if (!
d->addTransition)
307 }
else if (y != target.
item->
y()) {
308 if (!
d->moveTransition)
321 d->addTransitionManager.transition(
d->addActions,
d->addTransition);
322 d->moveTransitionManager.transition(
d->moveActions,
d->moveTransition);
323 d->addActions.clear();
324 d->moveActions.clear();
467 if(child.
item->
y() != voffset)
487 QDeclarativeAnchors::Anchors usedAnchors = anchors->
usedAnchors();
499 qmlInfo(
this) <<
"Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column";
674 if(child.
item->
x() != hoffset)
694 end = contentSize->
width();
704 if(child.
item->
x() != hoffset)
717 QDeclarativeAnchors::Anchors usedAnchors = anchors->
usedAnchors();
729 qmlInfo(
this) <<
"Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row";
994 int numVisible = visibleItems.
count();
997 r = (numVisible+3)/4;
1011 for (
int i=0; i < r; i++){
1012 for (
int j=0; j <
c; j++){
1018 if (childIndex == visibleItems.
count())
1023 if (childPrivate->
width() > maxColWidth[j])
1024 maxColWidth[j] = childPrivate->
width();
1025 if (childPrivate->
height() > maxRowHeight[i])
1026 maxRowHeight[i] = childPrivate->
height();
1030 for (
int j=0; j <
c; j++){
1031 for (
int i=0; i < r; i++){
1037 if (childIndex == visibleItems.
count())
1042 if (childPrivate->
width() > maxColWidth[j])
1043 maxColWidth[j] = childPrivate->
width();
1044 if (childPrivate->
height() > maxRowHeight[i])
1045 maxRowHeight[i] = childPrivate->
height();
1051 for(
int j=0; j < maxColWidth.
size(); j++){
1054 widthSum += maxColWidth[j];
1058 for(
int i=0; i < maxRowHeight.
size(); i++){
1061 heightSum += maxRowHeight[i];
1079 for (
int i = 0; i < visibleItems.
count(); ++i) {
1081 int childXOffset = xoffset;
1084 if((child.
item->
x()!=childXOffset)||(child.
item->
y()!=yoffset)){
1091 xoffset+=maxColWidth[curCol]+
spacing();
1093 xoffset-=maxColWidth[curCol]+
spacing();
1097 yoffset+=maxRowHeight[curRow]+
spacing();
1107 yoffset+=maxRowHeight[curRow]+
spacing();
1112 xoffset+=maxColWidth[curCol]+
spacing();
1114 xoffset-=maxColWidth[curCol]+
spacing();
1138 qmlInfo(
this) <<
"Cannot specify anchors for items inside Grid";
1296 if (
d->flow != flow) {
1334 return d->layoutDirection;
1340 if (
d->layoutDirection != layoutDirection) {
1370 voffset += linemax +
spacing();
1376 hoffset += linemax +
spacing();
1381 if(
d->isLeftToRight()){
1382 if(child.
item->
x() != hoffset)
1385 hoffsets << hoffset;
1387 if(child.
item->
y() != voffset)
1394 hoffset += childPrivate->
width();
1398 voffset += childPrivate->
height();
1404 if(
d->isLeftToRight())
1411 end = contentSize->
width();
1418 if(child.
item->
x() != hoffset)
1431 d->anchorConflict =
true;
1436 if (
d->anchorConflict)
1437 qmlInfo(
this) <<
"Cannot specify anchors for items inside Flow";
The QVariant class acts like a union for the most common Qt data types.
const T & at(int idx) const
QDeclarativeFlow::Flow flow
QDeclarativeColumn(QDeclarativeItem *parent=0)
~QDeclarativeBasePositioner()
QDeclarativeGrid(QDeclarativeItem *parent=0)
virtual void doPositioning(QSizeF *contentSize)
void setLayoutDirection(Qt::LayoutDirection)
virtual void doPositioning(QSizeF *contentSize)
#define QT_END_NAMESPACE
This macro expands to.
QDeclarativeParserStatus ** d
static const QDeclarativeItemPrivate::ChangeTypes watchedChanges
QDeclarativeRow(QDeclarativeItem *parent=0)
qreal y
the y position of the item
bool isLeftToRight() const
bool widthValid() const
Returns whether the width property has been set explicitly.
QDeclarativeTransition * add() const
virtual qreal height() const
bool isComponentComplete() const
Returns true if construction of the QML component is complete; otherwise returns false.
qreal width() const
Returns the width.
#define at(className, varName)
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
qreal height() const
Returns the height.
bool isVisible() const
Returns true if the item is visible; otherwise, false is returned.
virtual void reportConflictingAnchors()
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Qt::LayoutDirection layoutDirection() const
bool heightValid() const
Returns whether the height property has been set explicitly.
void setLayoutDirection(Qt::LayoutDirection)
int count(const T &t) const
Returns the number of occurrences of value in the list.
GraphicsItemChange
This enum describes the state changes that are notified by QGraphicsItem::itemChange().
virtual void doPositioning(QSizeF *contentSize)=0
void setWidth(qreal w)
Sets the width to the given width.
void setRows(const int rows)
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
QDeclarativeAnchors * _anchors
virtual void doPositioning(QSizeF *contentSize)
QGraphicsObject * toGraphicsObject()
Return the graphics item cast to a QGraphicsObject, if the class is actually a graphics object...
#define QT_BEGIN_NAMESPACE
This macro expands to.
QGraphicsObject * centerIn
The QDeclarativeItem class provides the most basic of all visual items in QML.
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
void addItemChangeListener(QDeclarativeItemChangeListener *listener, ChangeTypes types)
The QDeclarativeBasePositioner class provides a base for QDeclarativeGraphics layouts.
void layoutDirectionChanged()
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
const T & at(int i) const
Returns the item at index position i in the list.
static QDeclarativeItemPrivate * get(QDeclarativeItem *item)
QDeclarativeTransition * move() const
void finishApplyTransitions()
Qt::LayoutDirection layoutDirection() const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Qt::LayoutDirection effectiveLayoutDirection() const
void graphicsWidgetGeometryChanged()
Qt::LayoutDirection effectiveLayoutDirection() const
void positionX(int, const PositionedItem &target)
void setColumns(const int columns)
void setX(qreal x)
Set's the x coordinate of the item's position.
virtual void reportConflictingAnchors()=0
void setImplicitWidth(qreal)
Sets the implied width of the item to w.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
void setAdd(QDeclarativeTransition *)
virtual void reportConflictingAnchors()
Qt::LayoutDirection layoutDirection
void setLayoutDirection(Qt::LayoutDirection)
virtual QVariant itemChange(GraphicsItemChange, const QVariant &)
Note that unlike QGraphicsItems, QDeclarativeItem::itemChange() is not called during initial widget p...
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types)
#define Q_DECLARE_PUBLIC(Class)
qreal y() const
This convenience function is equivalent to calling pos().
Anchors usedAnchors() const
void unwatchChanges(QGraphicsObject *other)
virtual QVariant itemChange(GraphicsItemChange, const QVariant &)
Note that unlike QGraphicsItems, QDeclarativeItem::itemChange() is not called during initial widget p...
virtual void doPositioning(QSizeF *contentSize)
The Flow item arranges its children side by side, wrapping as necessary.
virtual qreal width() const
static Qt::LayoutDirection getLayoutDirection(const QDeclarativeBasePositioner *positioner)
void layoutDirectionChanged()
static Qt::LayoutDirection getEffectiveLayoutDirection(const QDeclarativeBasePositioner *positioner)
virtual void componentComplete()
QObject * parent() const
Returns a pointer to the parent object.
qreal x() const
This convenience function is equivalent to calling pos().
void setY(qreal y)
Set's the y coordinate of the item's position.
virtual void componentComplete()
int size() const
Returns the number of items in the list.
const QObjectList & children() const
Returns a list of child objects.
QPODVector< PositionedItem, 8 > positionedItems
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)
void layoutDirectionChanged()
void setMove(QDeclarativeTransition *)
void positionY(int, const PositionedItem &target)
void watchChanges(QGraphicsObject *other)
void setHeight(qreal h)
Sets the height to the given height.
QDeclarativeFlow(QDeclarativeItem *parent=0)
QDeclarativeBasePositioner(PositionerType, QDeclarativeItem *parent)
Qt::LayoutDirection effectiveLayoutDirection() const
quint32 isDeclarativeItem
qreal x
the x position of the item
QDeclarativeInfo qmlInfo(const QObject *me)
void setImplicitHeight(qreal)
Sets the implied height of the item to h.
T value() const
Returns the stored value converted to the template type T.
static const KeyPair *const end
The QGraphicsObject class provides a base class for all graphics items that require signals...
QDeclarativeFlowPrivate()
virtual void reportConflictingAnchors()
Qt::LayoutDirection layoutDirection() const
virtual void reportConflictingAnchors()
The QList class is a template class that provides lists.
QGraphicsObject *qreal opacity
the opacity of the item