• 4827阅读
  • 0回复

[讨论]QListWidget对象内容写入文本 [ [复制链接]

上一主题 下一主题
离线znekin
 
只看楼主 倒序阅读 楼主  发表于: 2011-04-13
ListWidgetContent = new QListWidget( this);
.........
  .........
bool TcpClient::saveFile(const QString &fileName)//保存文件
{
  QFile file(fileName);
  if(!file.open(QFile::WriteOnly | QFile::Text))

  {
  QMessageBox::warning(this,tr("保存文件"),
  tr("无法保存文件 %1:\n %2").arg(fileName)
  .arg(file.errorString()));
  return false;
  }
  QTextStream out(&file);
  out<<ListWidgetContent->item(2)->text();//第2行写入文本
  (如何将ListWidgetContent的内容全部写入文本)
  return true;
}
在下刚入门,请大侠帮忙解决下。小生在此谢过
快速回复
限100 字节
 
上一个 下一个