{"id":40,"date":"2009-02-02T04:00:09","date_gmt":"2009-02-02T10:00:09","guid":{"rendered":"http:\/\/www.ancor.ch\/schoebey\/?p=40"},"modified":"2009-02-02T10:01:31","modified_gmt":"2009-02-02T16:01:31","slug":"questionnaire","status":"publish","type":"post","link":"https:\/\/www.ancor.ch\/schoebey\/?p=40","title":{"rendered":"questionnaire"},"content":{"rendered":"<pre lang=\"cpp\">\r\nstruct SQuestion {\r\n    QString sQuestion;\r\n    std::vector<std::pair<QString, bool>> vAnswers;\r\n}\r\n<\/pre>\n<p>questionnaire_plugin:<\/p>\n<p>* std::vector&lt;SQuestion&gt; m_vQuestions;<\/p>\n<p><!--more--><\/p>\n<p>save code:<\/p>\n<pre lang=\"cpp\">open file;\r\n\r\nstream << question;\r\nstream << nofanswers;\r\n\r\nforeach(answer) { stream << answer.string << answer.bool }<\/pre>\n<p>load code:<\/p>\n<pre lang=\"cpp\">\r\nopen file;\r\n\r\nwhile(!file.endOfStream())\r\n{\r\n    stream >> question;\r\n    stream >> nofanswers;\r\n    for(i = 0..nofanswers)\r\n    {\r\n        stream >> anwer.string >> answer.bool;\r\n    }\r\n}<\/pre>\n<p>browsing:<\/p>\n<pre lang=\"cpp\">\r\nforward, backward, front, back\r\non_pForward_click()\r\n{\r\n    showQuestion(++m_iQuestion);\r\n}\r\n\r\nvoid showQuestion(int iQuestion, bool bEdit)\r\n{\r\n    m_ui.pQuestionLabel->setText(m_vQuestions[m_iQuestion].sQuestion);\r\n    m_ui.pFrame->clear();\r\n    for(int i = 0; i < m_vQuestions[m_iQuestion].vAnswers.size(); ++i)\r\n    {\r\n        QCheckBox* pCheckBox = new QCheckBox(m_vQuestions[m_iQuestion].vAnswers[i].first);\r\n        pCheckBox->setChecked(m_vQuestions[m_iQuestion].vAnswers[i].second);\r\n        m_ui.pFrame->addWidget(pCheckBox);\r\n    }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>struct SQuestion { QString sQuestion; std::vector vAnswers; } questionnaire_plugin: * std::vector&lt;SQuestion&gt; m_vQuestions;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-40","post","type-post","status-publish","format-standard","hentry","category-code"],"_links":{"self":[{"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=\/wp\/v2\/posts\/40","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=40"}],"version-history":[{"count":7,"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=\/wp\/v2\/posts\/40\/revisions"}],"predecessor-version":[{"id":43,"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=\/wp\/v2\/posts\/40\/revisions\/43"}],"wp:attachment":[{"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=40"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=40"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ancor.ch\/schoebey\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=40"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}