Hello, I have an program. It's probably work's normally but in "Application Output" I got some Reference Errors:

Qt Code:
  1. qrc:/main.qml:17: ReferenceError: Keppoqml is not defined
  2. qrc:/main.qml:17: ReferenceError: Keppoqml is not defined
To copy to clipboard, switch view to plain text mode 

Qt Code:
  1. import QtQuick 2.9
  2. import QtQuick.Window 2.2
  3.  
  4. Window {
  5. visible: true
  6. width: 640
  7. height: 480
  8. title: qsTr("Hello World")
  9.  
  10. TextInput {
  11. id: textInput
  12. objectName:"inputText"
  13. x: 48
  14. y: 58
  15. width: 80
  16. height: 20
  17. text: Keppoqml.message // Here's the error.
  18. font.pixelSize: 12
  19. onTextEdited:{
  20. Keppoqml.setWindowName(textInput.text);
  21. }
  22. }
  23.  
  24. Rectangle {
  25. id: rectangle
  26. x: 276
  27. y: 41
  28. width: 112
  29. height: 56
  30. color: "#e30a0a"
  31.  
  32. MouseArea {
  33. id: mouseArea
  34. x: 0
  35. y: 0
  36. width: 112
  37. height: 56
  38. onClicked:{
  39. Siemaqml.check();
  40. }
  41. }
  42. }
  43.  
  44. Rectangle {
  45. id: rectangle1
  46. x: 276
  47. y: 180
  48. width: 112
  49. height: 62
  50. color: "#29ff46"
  51.  
  52. MouseArea {
  53. id: mouseArea1
  54. x: 0
  55. y: 0
  56. width: 112
  57. height: 62
  58. onClicked:{
  59. Siemaqml.load();
  60. }
  61. }
  62. }
  63.  
  64. Rectangle {
  65. id: rectangle2
  66. x: 36
  67. y: 227
  68. width: 101
  69. height: 106
  70. color: "#000000"
  71.  
  72. MouseArea {
  73. id: mouseArea2
  74. x: 0
  75. y: 0
  76. width: 101
  77. height: 106
  78. onClicked:{
  79. Keppoqml.checkload();
  80. }
  81. }
  82. }
  83. Rectangle {
  84. id: rectangle5
  85. x: 276
  86. y: 324
  87. width: 112
  88. height: 62
  89. color: "#29ff46"
  90.  
  91. MouseArea {
  92. id: mouseArea5
  93. x: 0
  94. y: 0
  95. width: 112
  96. height: 62
  97. onClicked:{
  98. Keppoqml.message;
  99. }
  100. }
  101. }
  102. }
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include <QGuiApplication>
  2. #include <QQmlApplicationEngine>
  3. #include <QDebug>
  4. #include <keppoxd.h>
  5. #include <siema.h>
  6. #include <QQmlContext>
  7. #include <QQmlApplicationEngine>
  8.  
  9. int main(int argc, char *argv[])
  10. {
  11.  
  12. QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
  13.  
  14. QGuiApplication app(argc, argv);
  15.  
  16.  
  17.  
  18. siema siema;
  19. keppoxd keppo;
  20.  
  21. keppo.siema = &siema;
  22.  
  23. QQmlApplicationEngine engine;
  24. const QUrl url(QStringLiteral("qrc:/main.qml"));
  25. QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
  26. &app, [url](QObject *obj, const QUrl &objUrl) {
  27. if (!obj && url == objUrl)
  28. QCoreApplication::exit(-1);
  29. }, Qt::QueuedConnection);
  30. engine.load(url);
  31.  
  32.  
  33. QQmlContext *ctx = engine.rootContext();
  34.  
  35. ctx->setContextProperty("Siemaqml", &siema);
  36. ctx->setContextProperty("Keppoqml", &keppo);
  37.  
  38. return app.exec();
  39. }
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #ifndef KEPPOXD_H
  2. #define KEPPOXD_H
  3.  
  4. #include <QObject>
  5. #include <QDebug>
  6. #include <QSettings>
  7. #include <QDir>
  8. #include <siema.h>
  9.  
  10. class keppoxd : public QObject
  11. {
  12. Q_OBJECT
  13. public:
  14. explicit keppoxd(QObject *parent = nullptr);
  15. siema *siema;
  16.  
  17. Q_PROPERTY(QString message READ message WRITE setWindowName NOTIFY textChanged)
  18.  
  19.  
  20. signals:
  21. void textChanged();
  22. public slots:
  23. QString message(){
  24. qDebug() << siema->name;
  25. return siema->name;
  26. }
  27. void setWindowName(QString value);
  28. void checkload();
  29.  
  30. };
  31.  
  32. #endif // KEPPOXD_H
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include "keppoxd.h"
  2.  
  3. keppoxd::keppoxd(QObject *parent) : QObject(parent)
  4. {
  5. connect(this, SIGNAL (textChanged()), this, SLOT(message()));
  6. }
  7.  
  8. void keppoxd::setWindowName(QString value)
  9. {
  10. siema->name = value;
  11. qDebug() << "siema.name value from keppo class " << siema->name;
  12. }
  13.  
  14. void keppoxd::checkload()
  15. {
  16. qDebug() << "keppoload " << siema->name;
  17. emit textChanged();
  18. }
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #ifndef SIEMA_H
  2. #define SIEMA_H
  3.  
  4. #include <QObject>
  5. #include <QDebug>
  6. #include <QSettings>
  7. #include <QDir>
  8. #include <QQuickView>
  9.  
  10.  
  11. class siema : public QObject
  12. {
  13. Q_OBJECT
  14.  
  15.  
  16. public:
  17. explicit siema(QObject *parent = nullptr);
  18.  
  19. QString name = "old";
  20.  
  21. signals:
  22. public slots:
  23. void check();
  24. void load();
  25.  
  26. };
  27.  
  28. #endif // SIEMA_H
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. #include "siema.h"
  2.  
  3. siema::siema(QObject *parent) : QObject(parent)
  4. {
  5. }
  6.  
  7. void siema::check()
  8. {
  9. qDebug() << "siema value " << name;
  10.  
  11. QSettings* settings;
  12. settings = new QSettings(QDir::currentPath() + "/config.ini", QSettings::IniFormat);
  13. settings->setValue("textfield", name);
  14. settings->sync();
  15. }
  16. void siema::load(){
  17. QSettings* settings;
  18. settings = new QSettings(QDir::currentPath() + "/config.ini", QSettings::IniFormat);
  19. name = settings->value("textfield").toString();
  20. }
To copy to clipboard, switch view to plain text mode