diff --git a/logic/include/viewModel/BaseViewModel.h b/logic/include/viewModel/BaseViewModel.h index 610a18d..592fab7 100644 --- a/logic/include/viewModel/BaseViewModel.h +++ b/logic/include/viewModel/BaseViewModel.h @@ -16,6 +16,7 @@ #include "viewModel/utils/UsList.h" #include "viewModel/utils/UsImage.h" #include "viewModel/utils/UsButtonDoubleText.h" +#include "viewModel/utils/UsJson.h" #define SINGLETON(NAME) \ diff --git a/logic/include/viewModel/markerMode/MarkerModeViewModel.h b/logic/include/viewModel/markerMode/MarkerModeViewModel.h index 53b425b..0029d7d 100644 --- a/logic/include/viewModel/markerMode/MarkerModeViewModel.h +++ b/logic/include/viewModel/markerMode/MarkerModeViewModel.h @@ -13,7 +13,7 @@ class MarkerModeViewModel : public BaseViewModel //=======JoySticks======= US_JOYSTICK_NUMBER(BodyMarkAngle, "Angle", "", "", true, true, 0) - US_JOYSTICK_NUMBER(BodyMark, "BodyMark", "", "", true, true, 0) + US_JOYSTICK_NUMBER(JoystickBodyMark, "BodyMark", "", "", true, true, 0) US_JOYSTICK_NUMBER(PointerAngle, "Angle", "", "", true, true, 0) US_JOYSTICK_NUMBER(IndicatorSize, "Indicator Size", "", "", true, true, 0) @@ -27,9 +27,10 @@ class MarkerModeViewModel : public BaseViewModel US_JOYSTICK_PUSH (DeleteLast,"Delete Last",true,true,0) US_JOYSTICK_PUSH (DeleteAll,"Delete All",true,true,0) //=======JoySticks======= -// US_PROPERTY (Bodymark) + //=======Pointer======= + US_JSON(BodyMark,"a",1) }; diff --git a/logic/include/viewModel/utils/UsJson.h b/logic/include/viewModel/utils/UsJson.h new file mode 100644 index 0000000..3f92e39 --- /dev/null +++ b/logic/include/viewModel/utils/UsJson.h @@ -0,0 +1,11 @@ +#ifndef USJSON_H +#define USJSON_H +#include "AutoProperty.h" + +#define US_JSON(NAME, \ + JSON, \ + VALUE) \ + US_PROPERTY(int, NAME, VALUE) \ + US_PROPERTY(QString, NAME ## Json, JSON) + +#endif // USJSON_H diff --git a/logic/logic.pro b/logic/logic.pro index b5cce2c..3cac8cf 100644 --- a/logic/logic.pro +++ b/logic/logic.pro @@ -9,9 +9,10 @@ TARGET = logic DEFINES += QT_DEPRECATED_WARNINGS \ QT_QPA_EGLFS_HIDECURSOR -SOURCES += $$files(src/*.cpp, true) \ +SOURCES += $$files(src/*.cpp, true) -HEADERS += $$files(include/*.h, true) +HEADERS += $$files(include/*.h, true) \ + include/viewModel/utils/UsJson.h RESOURCES += \ logic.qrc diff --git a/logic/src/viewModel/markerMode/MarkerModeViewModel.cpp b/logic/src/viewModel/markerMode/MarkerModeViewModel.cpp index 3dc6009..c55675a 100644 --- a/logic/src/viewModel/markerMode/MarkerModeViewModel.cpp +++ b/logic/src/viewModel/markerMode/MarkerModeViewModel.cpp @@ -1,5 +1,8 @@ -#include "viewModel/markerMode/MarkerModeViewModel.h" +#include +#include +#include +#include "viewModel/markerMode/MarkerModeViewModel.h" #include "viewModel/UsmMimic.h" @@ -10,6 +13,17 @@ MarkerModeViewModel::MarkerModeViewModel() } void MarkerModeViewModel::init() { + QJsonArray jsonArray; + + QJsonObject jsonObjectLeg; + QJsonArray jsonArrayLeg = {"foot1","foot2","foot3"}; + jsonObjectLeg.insert ("Leg",jsonArrayLeg); + + jsonArray.append (jsonObjectLeg); + QJsonDocument jsonDoc; + jsonDoc.setArray(jsonArray); + QString answer = jsonDoc.toJson(); + BodyMarkJson (answer); } void MarkerModeViewModel::setInitialValue() {