Qt中QList用法

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)

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值