Advertisement
Touch_Grass

Untitled

Jul 9th, 2023
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.29 KB | Source Code | 0 0
  1. /* FILE NOTES:
  2.  *  USE:
  3.  *      defines and loads most of the stuff
  4.  *  EXPECTATION:
  5.  *      Loads stuff like data handler
  6. */
  7. //stuff i dont know what is for
  8. #include <QGuiApplication>
  9. #include <QQmlApplicationEngine>
  10.  
  11. #include <QSettings>
  12. #include <QString>
  13. #include <QVariant>
  14.  
  15. #include <iostream>
  16.  
  17. #include "dataHandler.h"
  18.  
  19. data_handler::data_handler(QObject *parent) : QObject(parent) {}
  20.  
  21. void data_handler::loadData() {
  22.     QSettings userData("OrganizationName", "ApplicationName");
  23.  
  24.     //gets all the data
  25.     QVariant list = userData.value("list");
  26.     QVariant points = userData.value("points");
  27.  
  28.     emit data_handler::response(list.toStringList(),points.toInt());
  29. }
  30.  
  31. void data_handler::saveData(QVector<QString> list, int points) {
  32.     QSettings userData("OrganizationName", "ApplicationName");
  33.  
  34.     //saves data
  35.     userData.setValue("list",list);
  36.     userData.setValue("points",points);
  37. }
  38.  
  39. int main(int argc, char *argv[])
  40. {
  41.     QGuiApplication app(argc, argv);
  42.  
  43.     QQmlApplicationEngine engine;
  44.     const QUrl url(u"qrc:/todover2/Main.qml"_qs);
  45.     QObject::connect(&engine, &QQmlApplicationEngine::objectCreationFailed,
  46.         &app, []() { QCoreApplication::exit(-1); },
  47.         Qt::QueuedConnection);
  48.     engine.load(url);
  49.  
  50.     return app.exec();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement