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

Public Functions

qreal colPos () const
 
bool contains (qreal x, qreal y) const
 
qreal endRowPos () const
 
 FxGridItem (QDeclarativeItem *i, QDeclarativeGridView *v)
 
qreal rowPos () const
 
void setPosition (qreal col, qreal row)
 
 ~FxGridItem ()
 

Public Variables

QDeclarativeGridViewAttachedattached
 
int index
 
QDeclarativeItemitem
 
QDeclarativeGridViewview
 

Detailed Description

Definition at line 65 of file qdeclarativegridview.cpp.

Constructors and Destructors

◆ FxGridItem()

FxGridItem::FxGridItem ( QDeclarativeItem i,
QDeclarativeGridView v 
)
inline

Definition at line 68 of file qdeclarativegridview.cpp.

Referenced by QDeclarativeGridViewPrivate::createHighlight(), QDeclarativeGridViewPrivate::createItem(), QDeclarativeGridViewPrivate::updateFooter(), and QDeclarativeGridViewPrivate::updateHeader().

68  : item(i), view(v) {
69  attached = static_cast<QDeclarativeGridViewAttached*>(qmlAttachedPropertiesObject<QDeclarativeGridView>(item));
70  if (attached)
72  }
QDeclarativeGridViewAttached * attached
QDeclarativeGridView * view
void setView(QDeclarativeGridView *view)
QDeclarativeItem * item

◆ ~FxGridItem()

FxGridItem::~FxGridItem ( )
inline

Definition at line 73 of file qdeclarativegridview.cpp.

73 {}

Functions

◆ colPos()

qreal FxGridItem::colPos ( ) const
inline

Definition at line 87 of file qdeclarativegridview.cpp.

Referenced by QDeclarativeGridViewPrivate::colPosAt(), QDeclarativeGridView::itemsMoved(), QDeclarativeGridViewPrivate::layout(), QDeclarativeGridViewPrivate::refill(), and QDeclarativeGridViewPrivate::snapIndex().

87  {
88  qreal colPos = 0;
91  int colSize = view->cellWidth();
92  int columns = view->width()/colSize;
93  colPos = colSize * (columns-1) - item->x();
94  } else {
95  colPos = item->x();
96  }
97  } else {
98  colPos = item->y();
99  }
100 
101  return colPos;
102  }
double qreal
Definition: qglobal.h:1193
Qt::LayoutDirection effectiveLayoutDirection() const
QDeclarativeGridView * view
qreal y() const
This convenience function is equivalent to calling pos().
qreal x() const
This convenience function is equivalent to calling pos().
qreal colPos() const
QDeclarativeItem * item

◆ contains()

bool FxGridItem::contains ( qreal  x,
qreal  y 
) const
inline

Definition at line 130 of file qdeclarativegridview.cpp.

Referenced by QDeclarativeGridView::indexAt().

130  {
131  return (x >= item->x() && x < item->x() + view->cellWidth() &&
132  y >= item->y() && y < item->y() + view->cellHeight());
133  }
QDeclarativeGridView * view
qreal y() const
This convenience function is equivalent to calling pos().
qreal x() const
This convenience function is equivalent to calling pos().
QDeclarativeItem * item

◆ endRowPos()

qreal FxGridItem::endRowPos ( ) const
inline

Definition at line 104 of file qdeclarativegridview.cpp.

Referenced by QDeclarativeGridViewPrivate::firstVisibleItem(), QDeclarativeGridViewPrivate::positionViewAtIndex(), and QDeclarativeGridViewPrivate::updateFooter().

104  {
106  return item->y() + view->cellHeight() - 1;
107  } else {
109  return -item->x() - 1;
110  else
111  return item->x() + view->cellWidth() - 1;
112  }
113  }
Qt::LayoutDirection effectiveLayoutDirection() const
QDeclarativeGridView * view
qreal y() const
This convenience function is equivalent to calling pos().
qreal x() const
This convenience function is equivalent to calling pos().
QDeclarativeItem * item

◆ rowPos()

qreal FxGridItem::rowPos ( ) const
inline

Definition at line 75 of file qdeclarativegridview.cpp.

Referenced by QDeclarativeGridViewPrivate::fixup(), QDeclarativeGridView::itemsMoved(), QDeclarativeGridViewPrivate::layout(), QDeclarativeGridViewPrivate::positionViewAtIndex(), QDeclarativeGridViewPrivate::refill(), QDeclarativeGridViewPrivate::rowPosAt(), QDeclarativeGridViewPrivate::snapIndex(), and QDeclarativeGridViewPrivate::snapItemAt().

75  {
76  qreal rowPos = 0;
78  rowPos = item->y();
79  } else {
81  rowPos = -view->cellWidth()-item->x();
82  else
83  rowPos = item->x();
84  }
85  return rowPos;
86  }
double qreal
Definition: qglobal.h:1193
Qt::LayoutDirection effectiveLayoutDirection() const
QDeclarativeGridView * view
qreal y() const
This convenience function is equivalent to calling pos().
qreal x() const
This convenience function is equivalent to calling pos().
qreal rowPos() const
QDeclarativeItem * item

◆ setPosition()

void FxGridItem::setPosition ( qreal  col,
qreal  row 
)
inline

Definition at line 114 of file qdeclarativegridview.cpp.

Referenced by QDeclarativeGridView::itemsInserted(), QDeclarativeGridView::itemsMoved(), QDeclarativeGridViewPrivate::layout(), QDeclarativeGridViewPrivate::refill(), and QDeclarativeGridViewPrivate::regenerate().

114  {
117  int columns = view->width()/view->cellWidth();
118  item->setPos(QPointF((view->cellWidth() * (columns-1) - col), row));
119  } else {
120  item->setPos(QPointF(-view->cellWidth()-row, col));
121  }
122  } else {
124  item->setPos(QPointF(col, row));
125  else
126  item->setPos(QPointF(row, col));
127  }
128 
129  }
Qt::LayoutDirection effectiveLayoutDirection() const
The QPointF class defines a point in the plane using floating point precision.
Definition: qpoint.h:214
void setPos(const QPointF &pos)
Sets the position of the item to pos, which is in parent coordinates.
QDeclarativeGridView * view
QDeclarativeItem * item

Properties

◆ attached

QDeclarativeGridViewAttached* FxGridItem::attached

◆ index

int FxGridItem::index

◆ item

QDeclarativeItem* FxGridItem::item

◆ view

QDeclarativeGridView* FxGridItem::view

Definition at line 136 of file qdeclarativegridview.cpp.

Referenced by colPos(), contains(), endRowPos(), FxGridItem(), rowPos(), and setPosition().


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