【问题标题】:c++ Error in Qt: has initializer but incomplete typeQt中的c ++错误:具有初始化程序但类型不完整
【发布时间】:2013-06-11 12:33:34
【问题描述】:
void FindWords::getTextFile() {
    QFile myFile(":/FindingWords2.txt");
    myFile.open(QIODevice::ReadOnly);

    QTextStream textStream(&myFile);
    QString line = textStream.readAll();
    myFile.close();

    ui->textEdit->setPlainText(line);
    QTextCursor textCursor = ui->textEdit->textCursor();
    textCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor, 1);
}

QTextStream textStream(&myFile) 不断给我错误,我无法修复它。

【问题讨论】:

    标签: c++ qt


    【解决方案1】:

    您忘记包含<QTextStream><QFile>

    【讨论】:

      【解决方案2】:

      我加了

      #include <QTextStream>
      #include <QFile>
      #include <QDataStream>
      

      它对我有用。

      【讨论】:

      • 你的答案和上一个完全一样。如果有的话,您应该考虑添加更多信息。
      猜你喜欢
      • 2011-05-16
      • 2012-11-05
      • 1970-01-01
      • 1970-01-01
      • 2012-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-05
      相关资源
      最近更新 更多