出现错误的原因可能是因为你将一个指向空指针的地址传递给了 setCurrentIndex() 函数,导致程序出现未知的行为。

你可以尝试以下代码:

void MainWindow::setListCurrentIndex(){
    QModelIndex index;
    ui->tw_process->setCurrentIndex(index);
}

或者使用以下代码:

void MainWindow::setListCurrentIndex(){
    ui->tw_process->setCurrentIndex(QModelIndex());
}

这样可以将一个有效的 QModelIndex 对象传递给 setCurrentIndex() 函数,避免出现未知的行为。

void MainWindowsetListCurrentIndex QModelIndex a=0; ui-tw_process-setCurrentIndex&a;报错了咋回事呢

原文地址: https://www.cveoy.top/t/topic/cwFy 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录