QList常用函數
public函數
void append(const T &value)// 從尾部添加
void append(const QList<T> &value)// 從尾部添加
const T &at(int i)
||
T value(int i) const
const T &back()
T &first()
T &front()
iterator begin()
iterator end()
bool contains(const T &value) const
int count(const T &value) const
int count()
||
int size() const
bool empty() const
||
bool isEmpty()
bool endsWith(const T &value)
bool startsWith(const T &value)
iterator erase(iterator pos)// 刪除,並後移
int indexOf(const T &value, int from = 0) const
void insert(int i, const T &value)
iterator insert(iterator before, const T &value)// 在before位置前,插入
T &last()
int lastIndexOf(const T &value, int from = -1) const
int length() const
QList<T> mid(int pos, int length = -1) const
void move(int from, int to)// 從from位置移動至to位置
void pop_back()// 移除
void pop_front()// 移除
void prepend(const T &value)// 在最前面插入
||
void push_front(const T &value)
void push_back(const T &value)// 在最後面插入
int removeAll(const T &value)
void removeAt(int i)
void removeFirst()
void removeLast()
bool removeOne(const T &value)// 移除第一個
void replace(int i, const T &value)
void reserve(int alloc)// 保留alloc個空間,若alloc 小於 size 不產生任何作用
void swap(int i, int j)
T takeAt(int i)
T takeFirst()
T takeLast()
std::list<T> toStdList() const
QVector<T> toVector() const
靜態函數:
QList<T> fromSet(const QSet<T> &set)
QList<T> fromStdList(const std::list<T> &list)
QList<T> fromVector(const QVector<T> &vector)