标题:qt 中这样的语句实施什么意思?
作者:ceiwei
日期:2017-02-09 16:46
内容:
编程语言C++qt 修改标签
model->removeRows(0,model->rowCount(QModelIndex()),QModelIndex());
(QModelIndex()这个是模型的最大索引号吗?我在帮助中只找到QModelIndex()这个类
rowCount(QModelIndex()这个是行数吗?
原始代码如下:
void MainWindow::openFile(QString path)
{
if (!path.isEmpty())
{
QFile file(path);
if (file.open(QFile::ReadOnly|QFile::Text))
{
QTextStream stream(&file);
QString line;
model->removeRows(0,model->rowCount(QModelIndex()),QModelIndex());
int row = 0;
do
{
line = stream.readLine();
if (!line.isEmpty())
{
model->insertRows(row, 1, QModelIndex());
&nb ..
#1 [cycloveu 02-10 09:28]
QModelIndex():创建一个空的模型索引。作用是用来表明这个位置在模型中时合法的。