Qt 4.8
qdeclarativepositioners.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "private/qdeclarativepositioners_p.h"
43 #include "private/qdeclarativepositioners_p_p.h"
44 
45 #include <qdeclarative.h>
46 #include <qdeclarativestate_p.h>
49 #include <qdeclarativeinfo.h>
50 #include <QtCore/qmath.h>
51 
52 #include <QDebug>
53 #include <QCoreApplication>
54 
56 
57 static const QDeclarativeItemPrivate::ChangeTypes watchedChanges
63 
65 {
68  otherPrivate->addItemChangeListener(this, watchedChanges);
69  } else {
71  QObject::connect(other, SIGNAL(widthChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
72  QObject::connect(other, SIGNAL(heightChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
73  QObject::connect(other, SIGNAL(opacityChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
74  QObject::connect(other, SIGNAL(visibleChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
75  }
76 }
77 
79 {
82  otherPrivate->removeItemChangeListener(this, watchedChanges);
83  } else {
85  QObject::disconnect(other, SIGNAL(widthChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
86  QObject::disconnect(other, SIGNAL(heightChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
87  QObject::disconnect(other, SIGNAL(opacityChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
88  QObject::disconnect(other, SIGNAL(visibleChanged()), q, SLOT(graphicsWidgetGeometryChanged()));
89  }
90 }
91 
93 {
94  prePositioning();
95 }
96 
118 {
120  d->init(at);
121 }
122 
124  : QDeclarativeImplicitSizeItem(dd, parent)
125 {
127  d->init(at);
128 }
129 
131 {
133  for (int i = 0; i < positionedItems.count(); ++i)
134  d->unwatchChanges(positionedItems.at(i).item);
135  positionedItems.clear();
136 }
137 
139 {
141  return d->spacing;
142 }
143 
145 {
147  if (s==d->spacing)
148  return;
149  d->spacing = s;
150  prePositioning();
152 }
153 
155 {
157  return d->moveTransition;
158 }
159 
161 {
163  if (mt == d->moveTransition)
164  return;
165  d->moveTransition = mt;
166  emit moveChanged();
167 }
168 
170 {
172  return d->addTransition;
173 }
174 
176 {
178  if (add == d->addTransition)
179  return;
180 
181  d->addTransition = add;
182  emit addChanged();
183 }
184 
186 {
189  positionedItems.reserve(d->QGraphicsItemPrivate::children.count());
190  prePositioning();
192 }
193 
195  const QVariant &value)
196 {
198  if (change == ItemChildAddedChange){
199  QGraphicsItem* item = value.value<QGraphicsItem*>();
200  QGraphicsObject* child = 0;
201  if(item)
202  child = item->toGraphicsObject();
203  if (child)
204  prePositioning();
205  } else if (change == ItemChildRemovedChange) {
206  QGraphicsItem* item = value.value<QGraphicsItem*>();
207  QGraphicsObject* child = 0;
208  if(item)
209  child = item->toGraphicsObject();
210  if (child) {
212  int idx = positionedItems.find(posItem);
213  if (idx >= 0) {
214  d->unwatchChanges(child);
215  positionedItems.remove(idx);
216  }
217  prePositioning();
218  }
219  }
220  return QDeclarativeItem::itemChange(change, value);
221 }
222 
224 {
226  if (!isComponentComplete())
227  return;
228 
229  if (d->doingPositioning)
230  return;
231 
232  d->queuedPositioning = false;
233  d->doingPositioning = true;
234  //Need to order children by creation order modified by stacking order
235  QList<QGraphicsItem *> children = d->QGraphicsItemPrivate::children;
236  qSort(children.begin(), children.end(), d->insertionOrder);
237 
239  positionedItems.copyAndClear(oldItems);
240  for (int ii = 0; ii < children.count(); ++ii) {
241  QGraphicsObject *child = children.at(ii)->toGraphicsObject();
242  if (!child)
243  continue;
244  QGraphicsItemPrivate *childPrivate = static_cast<QGraphicsItemPrivate*>(QGraphicsItemPrivate::get(child));
245  PositionedItem *item = 0;
246  PositionedItem posItem(child);
247  int wIdx = oldItems.find(posItem);
248  if (wIdx < 0) {
249  d->watchChanges(child);
250  positionedItems.append(posItem);
251  item = &positionedItems[positionedItems.count()-1];
252  item->isNew = true;
253  if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden || !childPrivate->width() || !childPrivate->height())
254  item->isVisible = false;
255  } else {
256  item = &oldItems[wIdx];
257  // Items are only omitted from positioning if they are explicitly hidden
258  // i.e. their positioning is not affected if an ancestor is hidden.
259  if (child->opacity() <= 0.0 || childPrivate->explicitlyHidden || !childPrivate->width() || !childPrivate->height()) {
260  item->isVisible = false;
261  } else if (!item->isVisible) {
262  item->isVisible = true;
263  item->isNew = true;
264  } else {
265  item->isNew = false;
266  }
267  positionedItems.append(*item);
268  }
269  }
270  QSizeF contentSize;
271  doPositioning(&contentSize);
272  if(d->addTransition || d->moveTransition)
274  d->doingPositioning = false;
275  //Set implicit size to the size of its children
276  setImplicitHeight(contentSize.height());
277  setImplicitWidth(contentSize.width());
278 }
279 
281 {
283  if(d->type == Horizontal || d->type == Both){
284  if (target.isNew) {
285  if (!d->addTransition)
286  target.item->setX(x);
287  else
288  d->addActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
289  } else if (x != target.item->x()) {
290  if (!d->moveTransition)
291  target.item->setX(x);
292  else
293  d->moveActions << QDeclarativeAction(target.item, QLatin1String("x"), QVariant(x));
294  }
295  }
296 }
297 
299 {
301  if(d->type == Vertical || d->type == Both){
302  if (target.isNew) {
303  if (!d->addTransition)
304  target.item->setY(y);
305  else
306  d->addActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
307  } else if (y != target.item->y()) {
308  if (!d->moveTransition)
309  target.item->setY(y);
310  else
311  d->moveActions << QDeclarativeAction(target.item, QLatin1String("y"), QVariant(y));
312  }
313  }
314 }
315 
317 {
319  // Note that if a transition is not set the transition manager will
320  // apply the changes directly, in the case add/move aren't set
321  d->addTransitionManager.transition(d->addActions, d->addTransition);
322  d->moveTransitionManager.transition(d->moveActions, d->moveTransition);
323  d->addActions.clear();
324  d->moveActions.clear();
325 }
326 
455 {
456 }
457 
459 {
460  int voffset = 0;
461 
462  for (int ii = 0; ii < positionedItems.count(); ++ii) {
463  const PositionedItem &child = positionedItems.at(ii);
464  if (!child.item || !child.isVisible)
465  continue;
466 
467  if(child.item->y() != voffset)
468  positionY(voffset, child);
469 
470  contentSize->setWidth(qMax(contentSize->width(), QGraphicsItemPrivate::get(child.item)->width()));
471 
472  voffset += QGraphicsItemPrivate::get(child.item)->height();
473  voffset += spacing();
474  }
475 
476  contentSize->setHeight(voffset - spacing());
477 }
478 
480 {
482  for (int ii = 0; ii < positionedItems.count(); ++ii) {
483  const PositionedItem &child = positionedItems.at(ii);
484  if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
485  QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
486  if (anchors) {
487  QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors();
488  if (usedAnchors & QDeclarativeAnchors::TopAnchor ||
489  usedAnchors & QDeclarativeAnchors::BottomAnchor ||
490  usedAnchors & QDeclarativeAnchors::VCenterAnchor ||
491  anchors->fill() || anchors->centerIn()) {
492  d->anchorConflict = true;
493  break;
494  }
495  }
496  }
497  }
498  if (d->anchorConflict) {
499  qmlInfo(this) << "Cannot specify top, bottom, verticalCenter, fill or centerIn anchors for items inside Column";
500  }
501 }
502 
609 {
610 }
611 
638 {
640 }
641 
643 {
645  if (d->layoutDirection != layoutDirection) {
647  // For RTL layout the positioning changes when the width changes.
650  else
652  prePositioning();
654  }
655 }
656 
658 {
660 }
661 
663 {
665  int hoffset = 0;
666 
667  QList<int> hoffsets;
668  for (int ii = 0; ii < positionedItems.count(); ++ii) {
669  const PositionedItem &child = positionedItems.at(ii);
670  if (!child.item || !child.isVisible)
671  continue;
672 
673  if(d->isLeftToRight()){
674  if(child.item->x() != hoffset)
675  positionX(hoffset, child);
676  }else{
677  hoffsets << hoffset;
678  }
679 
680  contentSize->setHeight(qMax(contentSize->height(), QGraphicsItemPrivate::get(child.item)->height()));
681 
682  hoffset += QGraphicsItemPrivate::get(child.item)->width();
683  hoffset += spacing();
684  }
685 
686  contentSize->setWidth(hoffset - spacing());
687 
688  if(d->isLeftToRight())
689  return;
690 
691  //Right to Left layout
692  int end = 0;
693  if(!widthValid())
694  end = contentSize->width();
695  else
696  end = width();
697 
698  int acc = 0;
699  for (int ii = 0; ii < positionedItems.count(); ++ii) {
700  const PositionedItem &child = positionedItems.at(ii);
701  if (!child.item || !child.isVisible)
702  continue;
703  hoffset = end - hoffsets[acc++] - QGraphicsItemPrivate::get(child.item)->width();
704  if(child.item->x() != hoffset)
705  positionX(hoffset, child);
706  }
707 }
708 
710 {
712  for (int ii = 0; ii < positionedItems.count(); ++ii) {
713  const PositionedItem &child = positionedItems.at(ii);
714  if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
715  QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
716  if (anchors) {
717  QDeclarativeAnchors::Anchors usedAnchors = anchors->usedAnchors();
718  if (usedAnchors & QDeclarativeAnchors::LeftAnchor ||
719  usedAnchors & QDeclarativeAnchors::RightAnchor ||
720  usedAnchors & QDeclarativeAnchors::HCenterAnchor ||
721  anchors->fill() || anchors->centerIn()) {
722  d->anchorConflict = true;
723  break;
724  }
725  }
726  }
727  }
728  if (d->anchorConflict)
729  qmlInfo(this) << "Cannot specify left, right, horizontalCenter, fill or centerIn anchors for items inside Row";
730 }
731 
854  QDeclarativeBasePositioner(Both, parent), m_rows(-1), m_columns(-1), m_flow(LeftToRight)
855 {
856 }
857 
883 {
884  if (columns == m_columns)
885  return;
886  m_columns = columns;
887  prePositioning();
889 }
890 
892 {
893  if (rows == m_rows)
894  return;
895  m_rows = rows;
896  prePositioning();
897  emit rowsChanged();
898 }
899 
917 {
918  return m_flow;
919 }
920 
922 {
923  if (m_flow != flow) {
924  m_flow = flow;
925  prePositioning();
926  emit flowChanged();
927  }
928 }
929 
958 {
960 }
961 
963 {
965  if (d->layoutDirection != layoutDirection) {
967  // For RTL layout the positioning changes when the width changes.
970  else
972  prePositioning();
974  }
975 }
976 
978 {
980 }
981 
983 {
985  int c = m_columns;
986  int r = m_rows;
987  //Is allocating the extra QPODVector too much overhead?
988  QPODVector<PositionedItem, 8> visibleItems;//we aren't concerned with invisible items
989  visibleItems.reserve(positionedItems.count());
990  for(int i=0; i<positionedItems.count(); i++)
991  if(positionedItems[i].item && positionedItems[i].isVisible)
992  visibleItems.append(positionedItems[i]);
993 
994  int numVisible = visibleItems.count();
995  if (m_columns <= 0 && m_rows <= 0){
996  c = 4;
997  r = (numVisible+3)/4;
998  } else if (m_rows <= 0){
999  r = (numVisible+(m_columns-1))/m_columns;
1000  } else if (m_columns <= 0){
1001  c = (numVisible+(m_rows-1))/m_rows;
1002  }
1003 
1004  if(r==0 || c==0)
1005  return; //Nothing to do
1006 
1007  QList<int> maxColWidth;
1008  QList<int> maxRowHeight;
1009  int childIndex =0;
1010  if (m_flow == LeftToRight) {
1011  for (int i=0; i < r; i++){
1012  for (int j=0; j < c; j++){
1013  if (j==0)
1014  maxRowHeight << 0;
1015  if (i==0)
1016  maxColWidth << 0;
1017 
1018  if (childIndex == visibleItems.count())
1019  break;
1020 
1021  const PositionedItem &child = visibleItems.at(childIndex++);
1022  QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item);
1023  if (childPrivate->width() > maxColWidth[j])
1024  maxColWidth[j] = childPrivate->width();
1025  if (childPrivate->height() > maxRowHeight[i])
1026  maxRowHeight[i] = childPrivate->height();
1027  }
1028  }
1029  } else {
1030  for (int j=0; j < c; j++){
1031  for (int i=0; i < r; i++){
1032  if (j==0)
1033  maxRowHeight << 0;
1034  if (i==0)
1035  maxColWidth << 0;
1036 
1037  if (childIndex == visibleItems.count())
1038  break;
1039 
1040  const PositionedItem &child = visibleItems.at(childIndex++);
1041  QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item);
1042  if (childPrivate->width() > maxColWidth[j])
1043  maxColWidth[j] = childPrivate->width();
1044  if (childPrivate->height() > maxRowHeight[i])
1045  maxRowHeight[i] = childPrivate->height();
1046  }
1047  }
1048  }
1049 
1050  int widthSum = 0;
1051  for(int j=0; j < maxColWidth.size(); j++){
1052  if(j)
1053  widthSum += spacing();
1054  widthSum += maxColWidth[j];
1055  }
1056 
1057  int heightSum = 0;
1058  for(int i=0; i < maxRowHeight.size(); i++){
1059  if(i)
1060  heightSum += spacing();
1061  heightSum += maxRowHeight[i];
1062  }
1063 
1064  contentSize->setHeight(heightSum);
1065  contentSize->setWidth(widthSum);
1066 
1067  int end = 0;
1068  if(widthValid())
1069  end = width();
1070  else
1071  end = widthSum;
1072 
1073  int xoffset=0;
1074  if(!d->isLeftToRight())
1075  xoffset=end;
1076  int yoffset=0;
1077  int curRow =0;
1078  int curCol =0;
1079  for (int i = 0; i < visibleItems.count(); ++i) {
1080  const PositionedItem &child = visibleItems.at(i);
1081  int childXOffset = xoffset;
1082  if(!d->isLeftToRight())
1083  childXOffset -= QGraphicsItemPrivate::get(child.item)->width();
1084  if((child.item->x()!=childXOffset)||(child.item->y()!=yoffset)){
1085  positionX(childXOffset, child);
1086  positionY(yoffset, child);
1087  }
1088 
1089  if (m_flow == LeftToRight) {
1090  if(d->isLeftToRight())
1091  xoffset+=maxColWidth[curCol]+spacing();
1092  else
1093  xoffset-=maxColWidth[curCol]+spacing();
1094  curCol++;
1095  curCol%=c;
1096  if (!curCol){
1097  yoffset+=maxRowHeight[curRow]+spacing();
1098  if(d->isLeftToRight())
1099  xoffset=0;
1100  else
1101  xoffset=end;
1102  curRow++;
1103  if (curRow>=r)
1104  break;
1105  }
1106  } else {
1107  yoffset+=maxRowHeight[curRow]+spacing();
1108  curRow++;
1109  curRow%=r;
1110  if (!curRow){
1111  if(d->isLeftToRight())
1112  xoffset+=maxColWidth[curCol]+spacing();
1113  else
1114  xoffset-=maxColWidth[curCol]+spacing();
1115  yoffset=0;
1116  curCol++;
1117  if (curCol>=c)
1118  break;
1119  }
1120  }
1121  }
1122 }
1123 
1125 {
1127  for (int ii = 0; ii < positionedItems.count(); ++ii) {
1128  const PositionedItem &child = positionedItems.at(ii);
1129  if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
1130  QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
1131  if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) {
1132  d->anchorConflict = true;
1133  break;
1134  }
1135  }
1136  }
1137  if (d->anchorConflict)
1138  qmlInfo(this) << "Cannot specify anchors for items inside Grid";
1139 }
1140 
1250 {
1252 
1253 public:
1256  {}
1257 
1259 };
1260 
1263 {
1265  // Flow layout requires relayout if its own size changes too.
1266  d->addItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
1267 }
1268 
1288 {
1289  Q_D(const QDeclarativeFlow);
1290  return d->flow;
1291 }
1292 
1294 {
1296  if (d->flow != flow) {
1297  d->flow = flow;
1298  prePositioning();
1299  emit flowChanged();
1300  }
1301 }
1302 
1332 {
1333  Q_D(const QDeclarativeFlow);
1334  return d->layoutDirection;
1335 }
1336 
1338 {
1340  if (d->layoutDirection != layoutDirection) {
1341  d->layoutDirection = layoutDirection;
1342  prePositioning();
1344  }
1345 }
1346 
1348 {
1350 }
1351 
1353 {
1355 
1356  int hoffset = 0;
1357  int voffset = 0;
1358  int linemax = 0;
1359  QList<int> hoffsets;
1360 
1361  for (int i = 0; i < positionedItems.count(); ++i) {
1362  const PositionedItem &child = positionedItems.at(i);
1363  if (!child.item || !child.isVisible)
1364  continue;
1365 
1366  QGraphicsItemPrivate *childPrivate = QGraphicsItemPrivate::get(child.item);
1367  if (d->flow == LeftToRight) {
1368  if (widthValid() && hoffset && hoffset + childPrivate->width() > width()) {
1369  hoffset = 0;
1370  voffset += linemax + spacing();
1371  linemax = 0;
1372  }
1373  } else {
1374  if (heightValid() && voffset && voffset + childPrivate->height() > height()) {
1375  voffset = 0;
1376  hoffset += linemax + spacing();
1377  linemax = 0;
1378  }
1379  }
1380 
1381  if(d->isLeftToRight()){
1382  if(child.item->x() != hoffset)
1383  positionX(hoffset, child);
1384  }else{
1385  hoffsets << hoffset;
1386  }
1387  if(child.item->y() != voffset)
1388  positionY(voffset, child);
1389 
1390  contentSize->setWidth(qMax(contentSize->width(), hoffset + childPrivate->width()));
1391  contentSize->setHeight(qMax(contentSize->height(), voffset + childPrivate->height()));
1392 
1393  if (d->flow == LeftToRight) {
1394  hoffset += childPrivate->width();
1395  hoffset += spacing();
1396  linemax = qMax(linemax, qCeil(childPrivate->height()));
1397  } else {
1398  voffset += childPrivate->height();
1399  voffset += spacing();
1400  linemax = qMax(linemax, qCeil(childPrivate->width()));
1401  }
1402  }
1403 
1404  if(d->isLeftToRight())
1405  return;
1406 
1407  int end;
1408  if(widthValid())
1409  end = width();
1410  else
1411  end = contentSize->width();
1412  int acc = 0;
1413  for (int i = 0; i < positionedItems.count(); ++i) {
1414  const PositionedItem &child = positionedItems.at(i);
1415  if (!child.item || !child.isVisible)
1416  continue;
1417  hoffset = end - hoffsets[acc++] - QGraphicsItemPrivate::get(child.item)->width();
1418  if(child.item->x() != hoffset)
1419  positionX(hoffset, child);
1420  }
1421 }
1422 
1424 {
1426  for (int ii = 0; ii < positionedItems.count(); ++ii) {
1427  const PositionedItem &child = positionedItems.at(ii);
1428  if (child.item && QGraphicsItemPrivate::get(child.item)->isDeclarativeItem) {
1429  QDeclarativeAnchors *anchors = QDeclarativeItemPrivate::get(static_cast<QDeclarativeItem *>(child.item))->_anchors;
1430  if (anchors && (anchors->usedAnchors() || anchors->fill() || anchors->centerIn())) {
1431  d->anchorConflict = true;
1432  break;
1433  }
1434  }
1435  }
1436  if (d->anchorConflict)
1437  qmlInfo(this) << "Cannot specify anchors for items inside Flow";
1438 }
1439 
The QVariant class acts like a union for the most common Qt data types.
Definition: qvariant.h:92
const T & at(int idx) const
Definition: qpodvector_p.h:69
QDeclarativeColumn(QDeclarativeItem *parent=0)
QDeclarativeGrid(QDeclarativeItem *parent=0)
QGraphicsItem * parent
virtual void doPositioning(QSizeF *contentSize)
void setLayoutDirection(Qt::LayoutDirection)
virtual void doPositioning(QSizeF *contentSize)
unsigned char c[8]
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QDeclarativeParserStatus ** d
int qCeil(qreal v)
Definition: qmath.h:63
static const QDeclarativeItemPrivate::ChangeTypes watchedChanges
QDeclarativeRow(QDeclarativeItem *parent=0)
qreal y
the y position of the item
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.
Definition: qsize.h:284
#define at(className, varName)
#define SLOT(a)
Definition: qobjectdefs.h:226
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
Definition: qgraphicsitem.h:89
qreal height() const
Returns the height.
Definition: qsize.h:287
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.
Definition: qlist.h:267
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.
Definition: qlist.h:891
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.
Definition: qsize.h:290
void setRows(const int rows)
#define Q_D(Class)
Definition: qglobal.h:2482
The QSizeF class defines the size of a two-dimensional object using floating point precision...
Definition: qsize.h:202
QGraphicsObject * fill
void append(const T &v)
Definition: qpodvector_p.h:85
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_Q(Class)
Definition: qglobal.h:2483
Flow flow() const
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 SIGNAL(a)
Definition: qobjectdefs.h:227
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
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...
Definition: qobject.cpp:2580
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...
Definition: qlist.h:270
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
LayoutDirection
Definition: qnamespace.h:1580
static QDeclarativeItemPrivate * get(QDeclarativeItem *item)
QDeclarativeTransition * move() const
Qt::LayoutDirection layoutDirection() const
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
Qt::LayoutDirection effectiveLayoutDirection() const
Qt::LayoutDirection effectiveLayoutDirection() const
void positionX(int, const PositionedItem &target)
void setColumns(const int columns)
void setX(qreal x)
Set&#39;s the x coordinate of the item&#39;s position.
virtual void reportConflictingAnchors()=0
void setImplicitWidth(qreal)
Sets the implied width of the item to w.
void qSort(RandomAccessIterator start, RandomAccessIterator end)
Definition: qalgorithms.h:177
void setAdd(QDeclarativeTransition *)
virtual void reportConflictingAnchors()
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.
Definition: qobject.cpp:2895
void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types)
#define Q_DECLARE_PUBLIC(Class)
Definition: qglobal.h:2477
qreal y() const
This convenience function is equivalent to calling pos().
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)
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
qreal x() const
This convenience function is equivalent to calling pos().
void setY(qreal y)
Set&#39;s the y coordinate of the item&#39;s position.
virtual void componentComplete()
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
int count() const
Definition: qpodvector_p.h:148
const QObjectList & children() const
Returns a list of child objects.
Definition: qobject.h:197
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.
Definition: qsize.h:293
QDeclarativeFlow(QDeclarativeItem *parent=0)
QDeclarativeBasePositioner(PositionerType, QDeclarativeItem *parent)
void reserve(int count)
Definition: qpodvector_p.h:101
Qt::LayoutDirection effectiveLayoutDirection() const
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.
Definition: qvariant.h:332
Flow flow() const
static const KeyPair *const end
The QGraphicsObject class provides a base class for all graphics items that require signals...
virtual void reportConflictingAnchors()
Qt::LayoutDirection layoutDirection() const
virtual void reportConflictingAnchors()
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
QGraphicsObject *qreal opacity
the opacity of the item