Browse Source

+

feature/markerMode
pouya 3 years ago
parent
commit
8a8dfbc9b5
  1. 6
      logic/include/viewModel/markerMode/MarkerModeViewModel.h
  2. 2
      logic/include/viewModel/utils/UsJson.h
  3. 23
      logic/src/viewModel/markerMode/MarkerModeViewModel.cpp
  4. 2
      ui

6
logic/include/viewModel/markerMode/MarkerModeViewModel.h

@ -29,8 +29,10 @@ class MarkerModeViewModel : public BaseViewModel
//=======JoySticks=======
//=======Pointer=======
US_JSON(BodyMark,"a",1)
US_JSON(BodyMark,"a","")
US_JSON(BodyPart,"","")
};

2
logic/include/viewModel/utils/UsJson.h

@ -5,7 +5,7 @@
#define US_JSON(NAME, \
JSON, \
VALUE) \
US_PROPERTY(int, NAME, VALUE) \
US_PROPERTY(QString, NAME, VALUE) \
US_PROPERTY(QString, NAME ## Json, JSON)
#endif // USJSON_H

23
logic/src/viewModel/markerMode/MarkerModeViewModel.cpp

@ -1,9 +1,10 @@
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonDocument>
#include <QDebug>
#include "viewModel/markerMode/MarkerModeViewModel.h"
#include "viewModel/UsmMimic.h"
SINGLETON_DEF(MarkerModeViewModel)
@ -13,17 +14,27 @@ MarkerModeViewModel::MarkerModeViewModel()
}
void MarkerModeViewModel::init()
{
QJsonArray jsonArray;
//==================BodyMark================
QJsonObject mainObj;
QJsonObject jsonObjectLeg;
QJsonArray jsonArrayLeg = {"foot1","foot2","foot3"};
jsonObjectLeg.insert ("Leg",jsonArrayLeg);
mainObj.insert ("Leg",jsonArrayLeg);
QJsonArray jsonArrayHand = {"Hand1","Hand2","Hand3","Hand4"};
mainObj.insert ("Hand",jsonArrayHand);
jsonArray.append (jsonObjectLeg);
QJsonDocument jsonDoc;
jsonDoc.setArray(jsonArray);
jsonDoc.setObject (mainObj);
QString answer = jsonDoc.toJson();
BodyMarkJson (answer);
//==============BodyParts=====================
BodyPartJson (answer);
//================================
connect (this,&MarkerModeViewModel::BodyMarkChanged,[=](){
qDebug() << this->BodyMark() << "k";
});
qDebug() << "Hi";
}
void MarkerModeViewModel::setInitialValue()
{

2
ui

@ -1 +1 @@
Subproject commit 50fec2e3c8ce4837165dc7f1be2ead148614596a
Subproject commit e065d81a2ef2c17a3879badb16a90108327461be
Loading…
Cancel
Save