Qt & Qt Creator - robbiehume/CS-Notes GitHub Wiki

fix qDebug() output

.pro file for qmake

  • INCLUDEPATH: specifies the #include directories which should be searched for when compiling the project
  • HEADERS: list of headers that are part of your project and that moc might run on

QJson

  • Initialize multi-level QJsonObject (link):
    • QJsonObject o
      {
          {"x", QJsonObject { {"key", "value"} }}
      };
      
  • Convert QJsonObject to QString (link):
    • QJsonDocument doc(jsonObj);  // jsonObj is a populated QJsonObject
      QString jsonStr = doc.toJson(QJsonDocument::Indented);
      
  • Initialize QJsonDocument from QString: (link)
    • QJsonDocument doc = QJsonDocument::fromJson(data.toUtf8());   // data is a QString with json