clopPaperDetail.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536
  1. #include "clopPaperDetail.h"
  2. #include "ui_clopPaperDetail.h"
  3. #include "CAppInfo.h"
  4. #include "questionBody.h"
  5. #include "audioPlay.h"
  6. #include "logproc.h"
  7. #include "CCommonTools.h"
  8. #include "awMsgBox.h"
  9. clopPaperDetail::clopPaperDetail(__int64 nExamRecordDataId, QString sCourseCode, bool bFromCache, QWidget *parent) :
  10. QWidget(parent),
  11. ui(new Ui::clopPaperDetail), m_sCourseCode(sCourseCode), m_nExamRecordDataId(nExamRecordDataId),m_bFromCache(bFromCache)
  12. {
  13. ui->setupUi(this);
  14. setStyleSheet(g_appInfoPtr->m_sQssStr);
  15. qRegisterMetaType<CFindExamRecordDataEntity>("CFindExamRecordDataEntity");
  16. connect(g_httpBllPtr.get(), &CHttpBll::sgnFindExamRecordDataEntity, this, &clopPaperDetail::onFindExamRecordDataEntity);
  17. qRegisterMetaType<CGetExamRecordPaperStruct>("CGetExamRecordPaperStruct");
  18. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetExamRecordPaperStruct, this, &clopPaperDetail::onGetExamRecordPaperStruct);
  19. qRegisterMetaType<CGetExamRecordQuestions>("CGetExamRecordQuestions");
  20. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetExamRecordQuestions, this, &clopPaperDetail::onGetExamRecordQuestions);
  21. qRegisterMetaType<CGetQuestion>("CGetQuestion");
  22. connect(g_httpBllPtr.get(), &CHttpBll::sgnGetQuestion, this, &clopPaperDetail::onGetQuestion);
  23. {
  24. CHttpRequestPackage hrp;
  25. hrp.sUri = "/api/ecs_oe_admin/client/exam/process/getExamRecordPaperStruct";
  26. hrp.sParamList.push_back(QString("examRecordDataId,%1").arg(nExamRecordDataId));
  27. if(bFromCache)
  28. {
  29. hrp.sParamList.push_back(QString("fromCache,%1").arg(true));
  30. }
  31. hrp.nRequestType = RequestType::rtGetExamRecordPaperStruct;
  32. hrp.eParamType = HttpParamType::hptUrl;
  33. g_httpBllPtr->post(hrp);
  34. }
  35. {
  36. CHttpRequestPackage hrp;
  37. hrp.sUri = QString("/api/ecs_oe_admin/client/exam/process/findExamRecordDataEntity");
  38. hrp.sParamList.push_back(QString("examRecordDataId,%1").arg(m_nExamRecordDataId));
  39. if(bFromCache)
  40. {
  41. hrp.sParamList.push_back(QString("fromCache,%1").arg(true));
  42. }
  43. hrp.nRequestType = RequestType::rtFindExamRecordDataEntity;
  44. hrp.eParamType = HttpParamType::hptUrl;
  45. g_httpBllPtr->post(hrp);
  46. }
  47. }
  48. clopPaperDetail::~clopPaperDetail()
  49. {
  50. delete ui;
  51. }
  52. int clopPaperDetail::setUI(const int nWidth)
  53. {
  54. ui->btn_expandPaper->setGeometry(g_appInfoPtr->m_fRate*30, 0, g_appInfoPtr->m_fRate*108, g_appInfoPtr->m_fRate*32);
  55. ui->btn_expandPaper->setIconSize(QSize(g_appInfoPtr->m_fRate*14, g_appInfoPtr->m_fRate*14));
  56. ui->btn_expandPaper->setIcon(QIcon(":/images/icon-expand-paper.png"));
  57. ui->lw_paperDetail->setGeometry(ui->btn_expandPaper->x(), ui->btn_expandPaper->y() + ui->btn_expandPaper->height() + g_appInfoPtr->m_fRate*19,
  58. nWidth - g_appInfoPtr->m_fRate*30*2, 200);
  59. ui->lw_paperDetail->setVisible(false);
  60. return ui->btn_expandPaper->y() + ui->btn_expandPaper->height() + g_appInfoPtr->m_fRate*20;
  61. }
  62. void clopPaperDetail::onFindExamRecordDataEntity(CFindExamRecordDataEntity findExamRecordDataEntity)
  63. {
  64. if (findExamRecordDataEntity.nCode == 200)
  65. {
  66. m_nExamId = findExamRecordDataEntity.nExamId;
  67. m_sPaperType = findExamRecordDataEntity.sPaperType;
  68. CHttpRequestPackage hrp;
  69. hrp.sUri = QString("/api/ecs_oe_admin/client/exam/process/getExamRecordQuestions");
  70. hrp.sParamList.push_back(QString("examRecordDataId,%1").arg(m_nExamRecordDataId));
  71. if(m_bFromCache)
  72. {
  73. hrp.sParamList.push_back(QString("fromCache,%1").arg(true));
  74. }
  75. hrp.nRequestType = RequestType::rtGetExamRecordQuestions;
  76. hrp.eParamType = HttpParamType::hptUrl;
  77. g_httpBllPtr->post(hrp);
  78. }
  79. else
  80. {
  81. if(findExamRecordDataEntity.sMessage.isEmpty())
  82. {
  83. ShowMsg(QString::fromLocal8Bit("获取考试记录失败"), (QWidget*)(this->parent()));
  84. }
  85. else
  86. {
  87. ShowMsg(findExamRecordDataEntity.sMessage, (QWidget*)(this->parent()));
  88. }
  89. }
  90. }
  91. void clopPaperDetail::onGetExamRecordQuestions(CGetExamRecordQuestions getExamRecordQuestions)
  92. {
  93. if (getExamRecordQuestions.nCode == 200)
  94. {
  95. int nSize = getExamRecordQuestions.vExamRecordQuestions.size();
  96. for (int i = 0; i < nSize; ++i)
  97. {
  98. CAnsweredQuestion aq = getExamRecordQuestions.vExamRecordQuestions[i];
  99. setStudentAnswer(aq.nOrder, aq.sStudentAnswer);
  100. CHttpRequestPackage hrp;
  101. hrp.sUri = QString("/api/branch_ecs_ques/default_question/question/for/client");
  102. hrp.sParamList.push_back(QString("questionId,%1").arg(aq.sQuestionId));
  103. hrp.sParamList.push_back(QString("examId,%1").arg(m_nExamId));
  104. hrp.sParamList.push_back(QString("courseCode,%1").arg(m_sCourseCode));
  105. hrp.sParamList.push_back(QString("groupCode,%1").arg(m_sPaperType));
  106. hrp.nRequestType = RequestType::rtGetQuestion;
  107. hrp.eParamType = HttpParamType::hptBody;
  108. g_httpBllPtr->post(hrp);
  109. }
  110. }
  111. else
  112. {
  113. if(getExamRecordQuestions.sMessage.isEmpty())
  114. {
  115. ShowMsg(QString::fromLocal8Bit("获取题目信息失败"), (QWidget*)(this->parent()));
  116. }
  117. else
  118. {
  119. ShowMsg(getExamRecordQuestions.sMessage, (QWidget*)(this->parent()));
  120. }
  121. }
  122. }
  123. void clopPaperDetail::setStudentAnswer(int nOrder, QString sStudentAnswer)
  124. {
  125. for (CPaperGroupStruct &pgs : m_vPaperGroupStruct)
  126. {
  127. for (CQuestionStruct &qs : pgs.vQuestionStruct)
  128. {
  129. for (CSubQuestionStruct &sqs : qs.vSubQuestionStruct)
  130. {
  131. if (sqs.nOrder == nOrder)
  132. {
  133. sqs.sStudentAnswer = sStudentAnswer;
  134. break;
  135. }
  136. }
  137. }
  138. }
  139. }
  140. void clopPaperDetail::onGetExamRecordPaperStruct(CGetExamRecordPaperStruct getExamRecordPaperStruct)
  141. {
  142. if (getExamRecordPaperStruct.nCode == 200)
  143. {
  144. m_vPaperGroupStruct.swap(getExamRecordPaperStruct.vPaperGroupStruct);
  145. }
  146. else
  147. {
  148. if(getExamRecordPaperStruct.sMessage.isEmpty())
  149. {
  150. ShowMsg(QString::fromLocal8Bit("获取试卷结构失败"), (QWidget*)(this->parent()));
  151. }
  152. else
  153. {
  154. ShowMsg(getExamRecordPaperStruct.sMessage, (QWidget*)(this->parent()));
  155. }
  156. }
  157. }
  158. void clopPaperDetail::onGetQuestion(CGetQuestion getQuestion)
  159. {
  160. if (getQuestion.nCode == 200)
  161. {
  162. for (CPaperGroupStruct &pgs : m_vPaperGroupStruct)
  163. {
  164. for (CQuestionStruct &qs : pgs.vQuestionStruct)
  165. {
  166. if (qs.sQuestionId == getQuestion.sId)
  167. {
  168. qs.bHasContent = true;
  169. qs.sBody = getQuestion.sBody;
  170. qs.sVersion = getQuestion.sVersion;
  171. qs.bhasAudios = getQuestion.bhasAudios;
  172. for (int i = 0; i < getQuestion.vSubQuestion.size(); ++i)
  173. {
  174. CSubQuestion sq = getQuestion.vSubQuestion[i];
  175. qs.vSubQuestionStruct[i].sBody = sq.sBody;
  176. qs.vSubQuestionStruct[i].vRightAnswer.swap(sq.vRightAnswer);
  177. qs.vSubQuestionStruct[i].vOptions.swap(sq.vOptions);
  178. }
  179. break;
  180. }
  181. }
  182. }
  183. }
  184. else
  185. {
  186. if(getQuestion.sMessage.isEmpty())
  187. {
  188. ShowMsg(QString::fromLocal8Bit("获取试题失败"), (QWidget*)(this->parent()));
  189. }
  190. else
  191. {
  192. ShowMsg(getQuestion.sMessage, (QWidget*)(this->parent()));
  193. }
  194. }
  195. }
  196. void clopPaperDetail::on_btn_expandPaper_clicked()
  197. {
  198. bool bShow = true;
  199. for(CPaperGroupStruct &pgs : m_vPaperGroupStruct)
  200. {
  201. for (CQuestionStruct &qs : pgs.vQuestionStruct)
  202. {
  203. if (!qs.bHasContent)
  204. {
  205. CHttpRequestPackage hrp;
  206. hrp.sUri = QString("/api/branch_ecs_ques/default_question/question/for/client");
  207. hrp.sParamList.push_back(QString("questionId,%1").arg(qs.sQuestionId));
  208. hrp.sParamList.push_back(QString("examId,%1").arg(m_nExamId));
  209. hrp.sParamList.push_back(QString("courseCode,%1").arg(m_sCourseCode));
  210. hrp.sParamList.push_back(QString("groupCode,%1").arg(m_sPaperType));
  211. hrp.nRequestType = RequestType::rtGetQuestion;
  212. hrp.eParamType = HttpParamType::hptBody;
  213. g_httpBllPtr->post(hrp);
  214. bShow = false;
  215. }
  216. }
  217. }
  218. if (bShow)
  219. {
  220. int nIndex = 1;
  221. Json::Value jBody = Json::Value::null;
  222. for (int i = 0; i < m_vPaperGroupStruct.size(); ++i)
  223. {
  224. CPaperGroupStruct pgs = m_vPaperGroupStruct[i];
  225. QString sGroupBody = QString::fromLocal8Bit(R"({"sections":[{"blocks":[{"type":"text","value":"%1、%2"}]}]})")
  226. .arg(CCommonTools::Arab2Sinogram(pgs.nNumber)).arg(pgs.sGroupName);
  227. Json::Value blockItem = Json::Value::null;
  228. blockItem["type"] = "text";
  229. blockItem["value"] = (QString::fromLocal8Bit("%1、%2").arg(CCommonTools::Arab2Sinogram(pgs.nNumber)).arg(pgs.sGroupName)).toStdString();
  230. Json::Value block = Json::Value::null;
  231. block["blocks"].append(blockItem);
  232. jBody["sections"].append(block);
  233. for (CQuestionStruct &qs : pgs.vQuestionStruct)
  234. {
  235. if (!qs.sBody.isEmpty())
  236. {
  237. Json::Reader reader;
  238. Json::Value jQuestion = Json::Value::null;
  239. if (!reader.parse(qs.sBody.toStdString(), jQuestion))
  240. {
  241. // ShowMsg(QString::fromLocal8Bit("解析题干出错!"), g_appInfoPtr->m_answerWidget);
  242. myDebug() << QString::fromLocal8Bit("解析题干出错!");
  243. }
  244. for (int iq = 0; iq < jQuestion["sections"].size(); ++iq)
  245. {
  246. jBody["sections"].append(jQuestion["sections"][iq]);
  247. }
  248. }
  249. for (CSubQuestionStruct &sqs : qs.vSubQuestionStruct)
  250. {
  251. if (!sqs.sBody.isEmpty())
  252. {
  253. Json::Reader reader;
  254. Json::Value jSubQuestion = Json::Value::null;
  255. if (!reader.parse(sqs.sBody.toStdString(), jSubQuestion))
  256. {
  257. // ShowMsg(QString::fromLocal8Bit("解析题干出错!"), g_appInfoPtr->m_answerWidget);
  258. myDebug() << QString::fromLocal8Bit("解析题干出错!");
  259. }
  260. if (jSubQuestion["sections"][0]["blocks"][0]["type"] == "text")
  261. {
  262. QString sValue = jSubQuestion["sections"][0]["blocks"][0]["value"].asString().c_str();
  263. jSubQuestion["sections"][0]["blocks"][0]["value"] = (QString::fromLocal8Bit("%1、%2").arg(nIndex).arg(sValue)).toStdString();
  264. }
  265. else
  266. {
  267. Json::Value blockItem = Json::Value::null;
  268. blockItem["type"] = "text";
  269. blockItem["value"] = QString::fromLocal8Bit("% 1、").arg(nIndex).toStdString();
  270. Json::Value block = Json::Value::null;
  271. block["blocks"].append(blockItem);
  272. jBody["sections"].append(block);
  273. }
  274. for (int isq = 0; isq < jSubQuestion["sections"].size(); ++isq)
  275. {
  276. jBody["sections"].append(jSubQuestion["sections"][isq]);
  277. }
  278. }
  279. else
  280. {
  281. Json::Value blockItem = Json::Value::null;
  282. blockItem["type"] = "text";
  283. blockItem["value"] = QString::fromLocal8Bit("% 1、").arg(nIndex).toStdString();
  284. Json::Value block = Json::Value::null;
  285. block["blocks"].append(blockItem);
  286. jBody["sections"].append(block);
  287. }
  288. nIndex++;
  289. for (int io = 0; io < sqs.vOptions.size(); ++io)
  290. {
  291. QString sOption = sqs.vOptions[io].sBody;
  292. Json::Reader reader;
  293. Json::Value jOption = Json::Value::null;
  294. if (!reader.parse(sOption.toStdString(), jOption))
  295. {
  296. // ShowMsg(QString::fromLocal8Bit("解析题干出错!"), g_appInfoPtr->m_answerWidget);
  297. myDebug() << QString::fromLocal8Bit("解析题干出错!");
  298. }
  299. if (jOption["sections"][0]["blocks"][0]["type"] == "text")
  300. {
  301. QString sValue = jOption["sections"][0]["blocks"][0]["value"].asString().c_str();
  302. jOption["sections"][0]["blocks"][0]["value"] = (QString::fromLocal8Bit("%1、%2").arg(QChar('A' + io)).arg(sValue)).toStdString();
  303. }
  304. else
  305. {
  306. Json::Value blockItem = Json::Value::null;
  307. blockItem["type"] = "text";
  308. blockItem["value"] = QString::fromLocal8Bit("% 1、").arg(nIndex).toStdString();
  309. Json::Value block = Json::Value::null;
  310. block["blocks"].append(blockItem);
  311. jBody["sections"].append(block);
  312. }
  313. for (int iop = 0; iop < jOption["sections"].size(); ++iop)
  314. {
  315. jBody["sections"].append(jOption["sections"][iop]);
  316. }
  317. }
  318. int nRA = sqs.vRightAnswer.size();
  319. QString sRightAnswer = "";
  320. for (int ira = 0; ira < nRA; ++ira)
  321. {
  322. if(sqs.sQuestionType == QUESTION_TYPE::SingleChoice ||
  323. sqs.sQuestionType == QUESTION_TYPE::MultipleChoice ||
  324. sqs.sQuestionType == QUESTION_TYPE::TrueOrFalse)
  325. {
  326. Json::Reader reader;
  327. Json::Value jRightAnswer = Json::Value::null;
  328. if (!reader.parse(sqs.vRightAnswer[ira].toStdString(), jRightAnswer))
  329. {
  330. // ShowMsg(QString::fromLocal8Bit("解析题干出错!"), g_appInfoPtr->m_answerWidget);
  331. myDebug() << QString::fromLocal8Bit("解析题干出错!");
  332. }
  333. for(int nrai = 0; nrai < jRightAnswer["sections"].size(); ++nrai)
  334. {
  335. Json::Value jBlocks = jRightAnswer["sections"][nrai];
  336. for(int nb = 0; nb < jBlocks["blocks"].size(); nb++)
  337. {
  338. if(jBlocks["blocks"][nb]["type"] == "text")
  339. {
  340. if(sqs.sQuestionType != QUESTION_TYPE::TrueOrFalse)
  341. {
  342. sRightAnswer += 'A' + QString(jBlocks["blocks"][nb]["value"].asString().c_str()).toInt();
  343. }
  344. else
  345. {
  346. sRightAnswer += jBlocks["blocks"][nb]["value"].asString() == "true" ? QString::fromLocal8Bit("正确") : QString::fromLocal8Bit("错误");
  347. }
  348. }
  349. }
  350. }
  351. }
  352. else if (sqs.sQuestionType == QUESTION_TYPE::FillUp ||
  353. sqs.sQuestionType == QUESTION_TYPE::Essay)
  354. {
  355. sRightAnswer = sqs.vRightAnswer[ira];
  356. Json::Reader reader;
  357. Json::Value jRightAnswer = Json::Value::null;
  358. if (!reader.parse(sRightAnswer.toStdString(), jRightAnswer))
  359. {
  360. // ShowMsg(QString::fromLocal8Bit("解析题干出错!"), g_appInfoPtr->m_answerWidget);
  361. myDebug() << QString::fromLocal8Bit("解析题干出错!");
  362. }
  363. if(ira == 0)
  364. {
  365. Json::Value blockItemAns = Json::Value::null;
  366. blockItemAns["type"] = "text";
  367. blockItemAns["value"] = QString::fromLocal8Bit("正确答案:").toStdString();
  368. Json::Value blockAns = Json::Value::null;
  369. blockAns["blocks"].append(blockItemAns);
  370. jBody["sections"].append(blockAns);
  371. }
  372. for(int nrai = 0; nrai < jRightAnswer["sections"].size(); ++nrai)
  373. {
  374. jBody["sections"].append(jRightAnswer["sections"][nrai]);
  375. }
  376. }
  377. }
  378. if(sqs.sQuestionType == QUESTION_TYPE::SingleChoice ||
  379. sqs.sQuestionType == QUESTION_TYPE::MultipleChoice ||
  380. sqs.sQuestionType == QUESTION_TYPE::TrueOrFalse)
  381. {
  382. Json::Value blockItemAns = Json::Value::null;
  383. blockItemAns["type"] = "text";
  384. blockItemAns["value"] = (QString::fromLocal8Bit("正确答案:%1").arg(sRightAnswer)).toStdString();
  385. Json::Value blockAns = Json::Value::null;
  386. blockAns["blocks"].append(blockItemAns);
  387. jBody["sections"].append(blockAns);
  388. }
  389. QString sStudentAnswer = "";
  390. if (sqs.sQuestionType == QUESTION_TYPE::SingleChoice ||
  391. sqs.sQuestionType == QUESTION_TYPE::MultipleChoice ||
  392. sqs.sQuestionType == QUESTION_TYPE::TrueOrFalse)
  393. {
  394. for (int isal = 0; isal < sqs.sStudentAnswer.length(); ++isal)
  395. {
  396. sStudentAnswer += 'A' + QString(sqs.sStudentAnswer[isal]).toInt();
  397. }
  398. }
  399. else if (sqs.sQuestionType == QUESTION_TYPE::FillUp ||
  400. sqs.sQuestionType == QUESTION_TYPE::Essay)
  401. {
  402. sStudentAnswer += sqs.sStudentAnswer;
  403. }
  404. Json::Value blockItemStuAns = Json::Value::null;
  405. blockItemStuAns["type"] = "text";
  406. blockItemStuAns["value"] = (QString::fromLocal8Bit("考生答案:%1").arg(sStudentAnswer)).toStdString();
  407. Json::Value blockStuAns = Json::Value::null;
  408. blockStuAns["blocks"].append(blockItemStuAns);
  409. jBody["sections"].append(blockStuAns);
  410. Json::Value blockItem = Json::Value::null;
  411. blockItem["type"] = "text";
  412. blockItem["value"] = "";
  413. Json::Value block = Json::Value::null;
  414. block["blocks"].append(blockItem);
  415. jBody["sections"].append(block);
  416. }
  417. }
  418. }
  419. initQuestion(jBody);
  420. }
  421. }
  422. void clopPaperDetail::initQuestion(Json::Value jBody)
  423. {
  424. int nListHeight = 0;
  425. int nIndex = 1;
  426. int nSectionSize = jBody["sections"].size();
  427. Json::Value jSections = Json::Value::null;
  428. for (int i = 0; i < nSectionSize; i++)
  429. {
  430. Json::Value jblocks = Json::Value::null;
  431. int nBlockSize = jBody["sections"][i]["blocks"].size();
  432. for (int j = 0; j < nBlockSize; j++)
  433. {
  434. if (jBody["sections"][i]["blocks"][j]["type"].asString() == "audio")
  435. {
  436. if (jblocks != Json::Value::null ||
  437. jSections != Json::Value::null)
  438. {
  439. if (jblocks != Json::Value::null)
  440. {
  441. Json::Value jBlockItem = Json::Value::null;
  442. jBlockItem["blocks"] = jblocks;
  443. jblocks = Json::Value::null;
  444. jSections.append(jBlockItem);
  445. }
  446. Json::Value jQuestionBody = Json::Value::null;
  447. jQuestionBody["sections"] = jSections;
  448. jSections = Json::Value::null;
  449. jblocks = Json::Value::null;
  450. questionBody *wQB = new questionBody(jQuestionBody);
  451. QListWidgetItem *listItem = new QListWidgetItem;
  452. int nQBHeight = wQB->setUI(ui->lw_paperDetail->width() - 40, nIndex);
  453. listItem->setSizeHint(QSize(ui->lw_paperDetail->width() - 40, nQBHeight));
  454. ui->lw_paperDetail->addItem(listItem);
  455. ui->lw_paperDetail->setItemWidget(listItem, wQB);
  456. nListHeight += nQBHeight;
  457. }
  458. nIndex++;
  459. QString sAudioName = jBody["sections"][i]["blocks"][j]["ext2"].asString().c_str();
  460. QString sAudioUrl = jBody["sections"][i]["blocks"][j]["value"].asString().c_str();
  461. audioPlay *wAP = new audioPlay(sAudioName, sAudioUrl, 10);
  462. QListWidgetItem *listItem = new QListWidgetItem;
  463. int nAPHeight = wAP->setUI(ui->lw_paperDetail->width() - 40);
  464. listItem->setSizeHint(QSize(ui->lw_paperDetail->width() - 40, nAPHeight));
  465. ui->lw_paperDetail->addItem(listItem);
  466. ui->lw_paperDetail->setItemWidget(listItem, wAP);
  467. nListHeight += nAPHeight;
  468. }
  469. else
  470. {
  471. jblocks.append(jBody["sections"][i]["blocks"][j]);
  472. }
  473. }
  474. if (jblocks != Json::Value::null)
  475. {
  476. Json::Value jBlockItem = Json::Value::null;
  477. jBlockItem["blocks"] = jblocks;
  478. jblocks = Json::Value::null;
  479. jSections.append(jBlockItem);
  480. }
  481. }
  482. if (jSections != Json::Value::null)
  483. {
  484. Json::Value jQuestionBody = Json::Value::null;
  485. jQuestionBody["sections"] = jSections;
  486. jSections = Json::Value::null;
  487. questionBody *wQB = new questionBody(jQuestionBody);
  488. QListWidgetItem *listItem = new QListWidgetItem;
  489. int nQBHeight = wQB->setUI(ui->lw_paperDetail->width() - 40, nIndex);
  490. listItem->setSizeHint(QSize(ui->lw_paperDetail->width() - 40, nQBHeight));
  491. ui->lw_paperDetail->addItem(listItem);
  492. ui->lw_paperDetail->setItemWidget(listItem, wQB);
  493. nListHeight += nQBHeight;
  494. }
  495. ui->lw_paperDetail->setGeometry(ui->btn_expandPaper->x(), ui->btn_expandPaper->y() + ui->btn_expandPaper->height() + g_appInfoPtr->m_fRate * 19,
  496. width() - g_appInfoPtr->m_fRate * 30 * 2, nListHeight);
  497. ui->lw_paperDetail->setVisible(true);
  498. emit heightChange(ui->lw_paperDetail->y() + ui->lw_paperDetail->height() + g_appInfoPtr->m_fRate * 20);
  499. }