1

I’m trying to load some text to TextArea from a file in QRC. But I don't know how to do that. QML file QRC file


I tried to do that in C++, too. Code:

QFile file(":/assets/CREDIT.md");

But I just get an error: QIODevice::read (QFile, ":\assets\CREDIT.md"): device not open Cpp file

1 Answers1

2

The error is clear, you have to open the file:

QFile file(":/assets/CREDIT.md");
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
    return;
eyllanesc
  • 235,170
  • 19
  • 170
  • 241