Qt 4.8
Functions
qdeclarativelistmodel.cpp File Reference
#include "private/qdeclarativelistmodel_p_p.h"
#include "private/qdeclarativelistmodelworkeragent_p.h"
#include "private/qdeclarativeopenmetaobject_p.h"
#include <qdeclarativecustomparser_p.h>
#include <qdeclarativeparser_p.h>
#include <qdeclarativeengine_p.h>
#include <qdeclarativecontext.h>
#include <qdeclarativeinfo.h>
#include <QtCore/qdebug.h>
#include <QtCore/qstack.h>
#include <QXmlStreamReader>
#include <QtScript/qscriptvalueiterator.h>

Go to the source code of this file.

Functions

template<typename T >
void qdeclarativelistmodel_move (int from, int to, int n, T *items)
 

Function Documentation

◆ qdeclarativelistmodel_move()

template<typename T >
void qdeclarativelistmodel_move ( int  from,
int  to,
int  n,
T *  items 
)

Definition at line 62 of file qdeclarativelistmodel.cpp.

63 {
64  if (n == 1) {
65  items->move(from, to);
66  } else {
67  T replaced;
68  int i=0;
69  typename T::ConstIterator it=items->begin(); it += from+n;
70  for (; i<to-from; ++i,++it)
71  replaced.append(*it);
72  i=0;
73  it=items->begin(); it += from;
74  for (; i<n; ++i,++it)
75  replaced.append(*it);
76  typename T::ConstIterator f=replaced.begin();
77  typename T::Iterator t=items->begin(); t += from;
78  for (; f != replaced.end(); ++f, ++t)
79  *t = *f;
80  }
81 }
#define it(className, varName)