{"id":209754,"date":"2014-01-20T18:31:04","date_gmt":"2014-01-20T14:31:04","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=209754"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=209754","title":{"rendered":"<span class=\"post_title\">\u041f\u0438\u0448\u0435\u043c \u0441\u0430\u0439\u0442 \u0441 \u043d\u043e\u0432\u043e\u0441\u0442\u044f\u043c\u0438 \u043d\u0430 Wt<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0441\u0435\u0431\u0435. \u042f \u0441\u0442\u0443\u0434\u0435\u043d\u0442 4 \u043a\u0443\u0440\u0441\u0430 \u041c\u0410\u0418 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u00ab\u042d\u0412\u041c, \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u044b, \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u0441\u0435\u0442\u0438\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0430 \u0421++\/Qt. \u041e\u0447\u0435\u043d\u044c \u0434\u0430\u0432\u043d\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u043d\u043e \u0434\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0440\u0443\u043a\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c <a href=\"http:\/\/habrahabr.ru\/post\/142585\/\">\u0441\u0442\u0430\u0442\u044c\u044f \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e C++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Wt<\/a>, \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0431\u043b\u0438\u0436\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0440\u0430\u0431\u043e\u0447\u0435\u0433\u043e \u043c\u0435\u0441\u0442\u0430<\/h4>\n<p>  \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u044f \u043f\u0438\u0441\u0430\u043b \u043f\u043e\u0434 Gentoo-linux \u0432 Qt Creator. \u0415\u0441\u043b\u0438 \u0432\u044b \u0440\u0435\u0448\u0438\u0442\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a \u0436\u0435, \u0442\u043e \u0434\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b.<br \/>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u2014 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u00ab\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0430 \u0421++\u00bb \u0431\u0435\u0437 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 Qt. \u0425\u043e\u0442\u044f Wt \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e \u0441 Qt, \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u044d\u0442\u043e \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f.<br \/>  <img decoding=\"async\" src=\"http:\/\/habr.habrastorage.org\/post_images\/291\/9ad\/a20\/2919ada20ee27cc83f60de3af0bf45ca.jpg\"\/><\/p>\n<p>  \u042f \u043d\u0430\u0437\u0432\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442 MyApp. \u0414\u0430\u043b\u0435\u0435 \u043e\u0442\u043a\u0440\u043e\u0435\u043c \u0444\u0430\u0439\u043b MyApp.pro \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0435\u0433\u043e \u043e\u0442\u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u0443\u0435\u043c. \u0410 \u0438\u043c\u0435\u043d\u043d\u043e, \u0432 \u043c\u043e\u0451\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<blockquote><p>LIBS += -L\/usr\/lib -lwt -lwthttp -lwtdbo -lwtdbosqlite3 -I\/usr\/local\/include<br \/>  LIBS += -L\/usr\/local\/lib -lwthttp -lwt -lboost_regex -lboost_signals<br \/>  LIBS += -lboost_system -lboost_thread -lboost_filesystem -lboost_date_time -lpthread -lcrypt  <\/p><\/blockquote>\n<p>  \u0415\u0449\u0451 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0438\u043d\u043a\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443 resources \u0432 \u0442\u043e \u043c\u0435\u0441\u0442\u043e, \u043e\u0442\u043a\u0443\u0434\u0430 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043d\u0430\u0448 \u0441\u0430\u0439\u0442. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u043a:<br \/>  <code>ln -s \/usr\/share\/Wt\/resources\/ ~\/build-MyApp-Qt5-\u041e\u0442\u043b\u0430\u0434\u043a\u0430\/<\/code><\/p>\n<p>  \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043d\u043e\u0439.<\/p>\n<h4>\u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0451\u043c&#8230;<\/h4>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0443\u0441\u0442\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434:  <\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;Wt\/WServer&gt; #include &lt;Wt\/WApplication&gt;  using namespace Wt;  WApplication *createWidget(const WEnvironment& env) {     WApplication *app=new WApplication(env); \/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u0441\u0442\u043e\u0435 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435     app-&gt;setTitle(&quot;My Site&quot;); \/\/\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b (\u0442\u043e \u0436\u0435, \u0447\u0442\u043e \u0432 html &lt;title&gt;&lt;\/title&gt;)     app-&gt;setTheme(new Wt::WBootstrapTheme());  \/\/\u0411\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0438\u043b\u0438 bootstrap     return app; }  int main(int argc, char **argv) {   Wt::WServer server(argv[0]); \/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u0435\u0440\u0432\u0435\u0440    server.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION); \/\/\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u043c \u0435\u0433\u043e    server.addEntryPoint(Wt::Application,createWidget); \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c &quot;\u0442\u043e\u0447\u043a\u0443 \u0432\u0445\u043e\u0434\u0430&quot;    if (server.start()) {     int sig = Wt::WServer::waitForShutdown(); \/\/\u0415\u0441\u043b\u0438 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e, \u0436\u0434\u0451\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f     std::cerr &lt;&lt; &quot;Shutting down: (signal = &quot; &lt;&lt; sig &lt;&lt; &quot;)&quot; &lt;&lt; std::endl;     server.stop();   } } <\/code><\/pre>\n<p>  \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432\u0441\u0451 \u044d\u0442\u043e \u043d\u0430 localhost \u043d\u0430 \u043f\u043e\u0440\u0442\u0443 8080 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p>  <code>.\/myapp --docroot . --http-address 0.0.0.0 --http-port 8080<\/code><\/p>\n<p>  \u041f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043c\u043e\u0436\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 \u00ab\u041f\u0440\u043e\u0435\u043a\u0442\u044b-&gt;\u0417\u0430\u043f\u0443\u0441\u043a-&gt;\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b\u00bb<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/fc6\/774\/bfb\/fc6774bfbdc0a4c61a6570a1a3cbfde3.jpeg\"\/><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432\u0435\u0431-\u0441\u0435\u0440\u0432\u0435\u0440 \u0441 \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0447\u043a\u043e\u0439, \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <code>http:\/\/localhost:8080\/<\/code><\/p>\n<h4>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0435\u043d\u044e.<\/h4>\n<p>  \u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u043c\u0435\u043d\u044e \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u0430\u0439\u0442\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u044f \u043d\u0430\u0437\u0432\u0430\u043b \u0435\u0433\u043e \u00abPage\u00bb.<br \/>  page.h:<\/p>\n<pre><code class=\"cpp\">#ifndef PAGE_H #define PAGE_H  #include &lt;Wt\/WContainerWidget&gt; #include &lt;Wt\/WText&gt; #include &lt;Wt\/WString&gt; #include &lt;Wt\/WNavigationBar&gt; #include &lt;Wt\/WMenu&gt; #include &lt;Wt\/WStackedWidget&gt;  class Page : public Wt::WContainerWidget { public:     Page(WContainerWidget *parent = 0); private:     Wt::WStackedWidget *contentsStack;     Wt::WNavigationBar *NavBar;     Wt::WMenu *LeftMenu; };  #endif \/\/ PAGE_H <\/code><\/pre>\n<p>  page.cpp:<\/p>\n<pre><code class=\"cpp\">#include &quot;page.h&quot;  using namespace Wt;  Page::Page(WContainerWidget *parent):WContainerWidget(parent) {     setStyleClass(&quot;container&quot;);     contentsStack = new Wt::WStackedWidget(); \/\/\u0412 \u044d\u0442\u043e\u043c &quot;\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435&quot; \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432\u0438\u0434\u0436\u0435\u0442, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u043a\u0443\u0449\u0435\u043c\u0443 \u043f\u0443\u043d\u043a\u0442\u0443 \u043c\u0435\u043d\u044e     contentsStack-&gt;setStyleClass(&quot;container&quot;);     contentsStack-&gt;setPadding(48,Wt::Top); \/\/\u041f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u0435\u043d\u044e \u0431\u0443\u0434\u0435\u0442 \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0441\u0432\u0435\u0440\u0445\u0443 \u0438 \u0437\u0430\u043a\u0440\u043e\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0433\u043e &quot;\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430&quot;      NavBar = new WNavigationBar(this); \/\/\u0421\u0430\u043c\u0430 \u043f\u043e\u043b\u043e\u0441\u043e\u0447\u043a\u0430 \u043c\u0435\u043d\u044e     NavBar-&gt;setTitle(&quot;MyApp&quot;,&quot;http:\/\/localhost:8080&quot;); \/\/\u041a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043f\u0435\u0440\u0435\u0434 \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 \u043c\u0435\u043d\u044e, \u0430 \u0437\u0430\u043e\u0434\u043d\u043e \u0441\u0441\u044b\u043b\u043a\u0430     NavBar-&gt;setResponsive(true); \/\/\u041d\u0430\u0448\u0430 \u043f\u043e\u043b\u043e\u0441\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043f\u043e\u0434 \u0440\u0430\u0437\u043c\u0435\u0440 \u044d\u043a\u0440\u0430\u043d\u0430     NavBar-&gt;addStyleClass(&quot;container&quot;); \/\/\u0421\u0442\u0438\u043b\u044c bootstrap     NavBar-&gt;setPositionScheme(Wt::Fixed); \/\/\u0414\u0435\u043b\u0430\u0435\u043c \u043f\u043e\u043b\u043e\u0441\u043a\u0443 \u043c\u0435\u043d\u044e \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439     LeftMenu=new WMenu(contentsStack,this); \/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u043e\u0435 \u043c\u0435\u043d\u044e. \u0417\u0430\u043c\u0435\u0442\u044c\u0442\u0435, \u044d\u0442\u043e \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0443\u043d\u043a\u0442\u044b \u043c\u0435\u043d\u044e.     NavBar-&gt;addMenu(LeftMenu); \/\/\u0412\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0443\u043d\u043a\u0442\u044b \u043c\u0435\u043d\u044e \u0432 \u043f\u043e\u043b\u043e\u0441\u043a\u0443      LeftMenu-&gt;addItem(WString::fromUTF8(&quot;\u041d\u043e\u0432\u043e\u0441\u0442\u0438&quot;),new WText(WString::fromUTF8(&quot;\u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u043d\u043e\u0432\u043e\u0441\u0442\u0438&quot;))); \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u043c\u0435\u043d\u044e \u043f\u0443\u043d\u043a\u0442 &quot;\u041d\u043e\u0432\u043e\u0441\u0442\u0438&quot;.      addWidget(contentsStack); \/\/\u041c\u044b \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u043b\u0438 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0431\u0435\u0437 \u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044f, \u0438 \u043e\u043d \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f, \u043f\u043e\u043a\u0430 \u043c\u044b \u0435\u0433\u043e \u043a\u0443\u0434\u0430-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c. } <\/code><\/pre>\n<p>  \u0417\u0430\u043e\u0434\u043d\u043e \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u0432 main.cpp<\/p>\n<pre><code class=\"cpp\">... WApplication *createWidget(const WEnvironment& env) {     WApplication *app=new WApplication(env);     app-&gt;setTitle(&quot;My Site&quot;);      app-&gt;setTheme(new Wt::WBootstrapTheme());       new Page(app-&gt;root()); \/\/\u0412\u043e\u0442 \u044d\u0442\u0443!     return app; } ... <\/code><\/pre>\n<p>  \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/482\/794\/205\/4827942058bc392428cd7a3cb6a0af4e.jpeg\"\/><\/p>\n<h4>\u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c. \u0410 \u0433\u0434\u0435 \u0436\u0435 \u043d\u043e\u0432\u043e\u0441\u0442\u0438?<\/h4>\n<p>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0438 \u0434\u043e \u043d\u0438\u0445 \u0434\u043e\u0439\u0434\u0451\u043c. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043d\u0430\u043c \u043d\u0430\u0434\u043e \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u0411\u0414.<br \/>  \u0412 Wt \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0411\u0414, \u043a\u0430\u043a \u043f\u043e \u043c\u043d\u0435, \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e, \u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u044f \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0441\u044f \u0441 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u043e\u043c, \u043e\u0441\u043e\u0431\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u0438 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0443 \u043c\u0435\u043d\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u043b\u043e.<\/p>\n<p>  \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u2014 \u044d\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0448\u0430\u0431\u043b\u043e\u043d \u043d\u0430\u0448\u0435\u0439 \u043d\u043e\u0432\u043e\u0441\u0442\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u0430\u0441\u0441\u0430.<\/p>\n<p>  news.h:<\/p>\n<pre><code class=\"cpp\">#ifndef NEWS_H #define NEWS_H  #include &lt;Wt\/WDateTime&gt; #include &lt;Wt\/Dbo\/Types&gt; #include &lt;Wt\/Dbo\/WtSqlTraits&gt;  class News { public:     News();      std::string title; \/\/\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043d\u043e\u0432\u043e\u0441\u0442\u0438     std::string text; \/\/\u0422\u0435\u043a\u0441\u0442 \u043d\u043e\u0432\u043e\u0441\u0442\u0438     std::string author; \/\/\u0410\u0432\u0442\u043e\u0440 \u043d\u043e\u0432\u043e\u0441\u0442\u0438     Wt::WDateTime created; \/\/\u0414\u0430\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f      template&lt;class Action&gt; \/\/\u0410 \u044d\u0442\u043e \u043d\u0430\u0448 \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0411\u0414     void persist(Action& a)     {       Wt::Dbo::field(a, title, &quot;title&quot;);       Wt::Dbo::field(a, text, &quot;text&quot;);       Wt::Dbo::field(a, author, &quot;aurhor&quot;);       Wt::Dbo::field(a, created, &quot;created&quot;);     } };  DBO_EXTERN_TEMPLATES(News);  #endif \/\/ NEWS_H <\/code><\/pre>\n<p>  news.cpp:  <\/p>\n<pre><code class=\"cpp\">#include &quot;news.h&quot;  #include &lt;Wt\/Dbo\/Impl&gt;  DBO_INSTANTIATE_TEMPLATES(News);  News::News():     created(Wt::WDateTime::currentDateTime()) \/\/\u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u043b\u044f, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u0435 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0434\u0430\u0442\u0430 \u0438 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u0438. {} <\/code><\/pre>\n<p>  \u00ab\u0425\u043c, \u0438 \u043a\u0430\u043a \u044d\u0442\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f?\u00bb \u2014 \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u0435 \u0432\u044b. \u0412\u0441\u0451 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e. \u042f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b sqlite3 \u043f\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c (\u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u043e\u0441\u0442\u044c \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0438 \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 MySQL \u0432 Wt \u0443 \u043c\u0435\u043d\u044f \u043f\u043e \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u043c \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u043d\u0435 \u0441\u043e\u0431\u0440\u0430\u043b\u0430\u0441\u044c), \u043d\u043e \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043b\u044e\u0431\u043e\u0439 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0411\u0414.<\/p>\n<p>  \u041f\u0435\u0440\u0435\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c page.cpp:<\/p>\n<pre><code class=\"cpp\">#include &quot;page.h&quot; #include &quot;news.h&quot; #include &lt;Wt\/Dbo\/backend\/Sqlite3&gt; #include &lt;Wt\/WApplication&gt; #include &lt;Wt\/WPanel&gt;  using namespace Wt;  Page::Page(WContainerWidget *parent):WContainerWidget(parent) {     Wt::Dbo::backend::Sqlite3 DataBase=WApplication::instance()-&gt;appRoot() + &quot;myapp.db&quot;; \/\/\u0417\u0430\u0434\u0430\u0451\u043c \u0444\u0430\u0439\u043b \u0411\u0414     Wt::Dbo::Session DBSession; \/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0441\u0435\u0441\u0441\u0438\u044e     DBSession.setConnection(DataBase); \/\/\u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f      DBSession.mapClass&lt;News&gt;(&quot;news&quot;); \/\/\u0410\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 \u043a\u043b\u0430\u0441\u0441 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 news \u0432 \u0411\u0414      Wt::Dbo::Transaction transaction(DBSession); \/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e     try {         DBSession.createTables(); \/\/\u0415\u0441\u043b\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0411\u0414 \u043f\u043e\u043a\u0430 \u043d\u0435\u0442, \u0441\u043e\u0437\u0434\u0430\u0451\u043c \u0435\u0451 \u0442\u0430\u043a\u0438\u043c \u0432\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0412\u0441\u0435 \u043f\u043e\u043b\u044f \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.         Wt::log(&quot;info&quot;) &lt;&lt; &quot;Database created&quot;;     } catch (...) {         Wt::log(&quot;info&quot;) &lt;&lt; &quot;Using existing database&quot;;     }     transaction.commit();\/\/\u0417\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f      Wt::WTable *NewsTable=new Wt::WTable();\/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0434\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439     NewsTable-&gt;addStyleClass(&quot;container&quot;);\/\/\u0414\u0435\u043b\u0430\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0448\u0438\u0440\u0438\u043d\u044b      Wt::Dbo::Transaction transaction1(DBSession);\/\/\u0415\u0449\u0451 \u043e\u0434\u043d\u0430 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f. \u0418\u0445 \u043d\u0443\u0436\u043d\u043e \u043f\u043e \u043e\u0434\u043d\u043e\u0439 \u043d\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u0437\u0430\u043f\u0440\u043e\u0441, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044f \u043f\u043e\u043d\u044f\u043b.     Wt::Dbo::collection&lt;Wt::Dbo::ptr&lt;News&gt; &gt; a=DBSession.find&lt;News&gt;().orderBy(&quot;created desc&quot;);\/\/\u0417\u0430\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430\u0448\u0438 \u043d\u043e\u0432\u043e\u0441\u0442\u0438 \u0438\u0437 \u0411\u0414, \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0434\u0430\u0442\u0435 \u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f.     int j=0;     for (Wt::Dbo::collection&lt;Wt::Dbo::ptr&lt;News&gt; &gt;::const_iterator i = a.begin(); i != a.end(); ++i) {\/\/\u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u043d\u043e\u0432\u043e\u0441\u0442\u044f\u043c\u0438. \u042d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u043e\u043d\u0438 \u0441\u043e\u0437\u0434\u0430\u044e\u0442\u0441\u044f \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u043d\u0438\u043c. \u041f\u043e\u0447\u0442\u0438 \u0431\u044d\u0439\u0441\u0438\u043a =)         Wt::Dbo::ptr&lt;News&gt; Article = *i;         Wt::WPanel *panel = new Wt::WPanel();         panel-&gt;setTitle(Article.get()-&gt;title);         panel-&gt;setCentralWidget(new Wt::WText(WString::fromUTF8(&quot;&lt;p&gt;\u0410\u0432\u0442\u043e\u0440:&quot;)+Article.get()-&gt;author+&quot;&lt;\/p&gt;&lt;p&gt;&quot;+Article.get()-&gt;text+&quot;&lt;\/p&gt;&quot;));         NewsTable-&gt;elementAt(j,0)-&gt;addWidget(panel);         j++;     }     transaction1.commit();\/\/\u0417\u0430\u043a\u0440\u044b\u043b\u0438 \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044e. \u041a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f.      setStyleClass(&quot;container&quot;);     contentsStack = new Wt::WStackedWidget();     contentsStack-&gt;setStyleClass(&quot;container&quot;);     contentsStack-&gt;setPadding(48,Wt::Top);      NavBar = new WNavigationBar(this);     NavBar-&gt;setTitle(&quot;MyApp&quot;,&quot;http:\/\/cursed.redegrade.net&quot;);     NavBar-&gt;setResponsive(true);     NavBar-&gt;addStyleClass(&quot;container&quot;);     NavBar-&gt;setPositionScheme(Wt::Fixed);     LeftMenu=new WMenu(contentsStack,this);     NavBar-&gt;addMenu(LeftMenu);      LeftMenu-&gt;addItem(WString::fromUTF8(&quot;\u041d\u043e\u0432\u043e\u0441\u0442\u0438&quot;),NewsTable); \/\/\u041f\u0440\u0438\u043a\u0440\u0443\u0447\u0438\u0432\u0430\u0435\u043c \u043d\u0430\u0448\u0443 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443 \u0441 \u043d\u043e\u0432\u043e\u0441\u0442\u044f\u043c\u0438 \u043a \u043f\u0443\u043d\u043a\u0442\u0443 \u043c\u0435\u043d\u044e.      this-&gt;addWidget(contentsStack); } <\/code><\/pre>\n<h4>\u041d\u0443, \u043f\u043e \u043f\u043e\u0432\u043e\u0434\u0443 \u0432\u044b\u0432\u043e\u0434\u0430 \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439 \u0432\u0441\u0451 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0430 \u043a\u0430\u043a \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435?<\/h4>\n<p>  \u0425\u043c, \u0438 \u043f\u0440\u0430\u0432\u0434\u0430. \u041a\u0443\u0434\u0430 \u0431\u0435\u0437 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f. \u0421\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u043c. \u041f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441 Page \u0435\u0449\u0451 \u0440\u0430\u0437, \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>  page.h:<\/p>\n<pre><code class=\"cpp\">#ifndef PAGE_H #define PAGE_H  #include &lt;Wt\/WContainerWidget&gt; #include &lt;Wt\/WText&gt; #include &lt;Wt\/WString&gt; #include &lt;Wt\/WNavigationBar&gt; #include &lt;Wt\/WMenu&gt; #include &lt;Wt\/WTable&gt; #include &lt;Wt\/WStackedWidget&gt; #include &lt;Wt\/Dbo\/Session&gt;  class Page : public Wt::WContainerWidget { public:     Page(WContainerWidget *parent = 0); private:     Wt::WStackedWidget *contentsStack;     Wt::WNavigationBar *NavBar;     Wt::WMenu *LeftMenu;     Wt::WTable *CreateArticle;     Wt::WLineEdit *Title;     Wt::WLineEdit *Author;     Wt::WTextArea *Text;     Wt::WPushButton *AddNews;     Wt::Dbo::Session DBSession;     void AddArticle(); };  #endif \/\/ PAGE_H <\/code><\/pre>\n<p>  page.cpp<\/p>\n<pre><code class=\"cpp\">#include &quot;page.h&quot; #include &quot;news.h&quot; #include &lt;Wt\/WApplication&gt; #include &lt;Wt\/WPanel&gt; #include &lt;Wt\/WLineEdit&gt; #include &lt;Wt\/WTextEdit&gt; #include &lt;Wt\/WPushButton&gt; #include &lt;Wt\/Dbo\/backend\/Sqlite3&gt;  using namespace Wt;  Page::Page(WContainerWidget *parent):WContainerWidget(parent) {     Wt::Dbo::backend::Sqlite3 DataBase=WApplication::instance()-&gt;appRoot() + &quot;myapp.db&quot;;     DBSession.setConnection(DataBase);      DBSession.mapClass&lt;News&gt;(&quot;news&quot;);      Wt::Dbo::Transaction transaction(DBSession);     try {         DBSession.createTables();         Wt::log(&quot;info&quot;) &lt;&lt; &quot;Database created&quot;;     } catch (...) {         Wt::log(&quot;info&quot;) &lt;&lt; &quot;Using existing database&quot;;     }     transaction.commit();      Wt::WTable *NewsTable=new Wt::WTable();     NewsTable-&gt;addStyleClass(&quot;container&quot;);      Wt::Dbo::Transaction transaction1(DBSession);     Wt::Dbo::collection&lt;Wt::Dbo::ptr&lt;News&gt; &gt; a=DBSession.find&lt;News&gt;().orderBy(&quot;created desc&quot;);     int j=0;     for (Wt::Dbo::collection&lt;Wt::Dbo::ptr&lt;News&gt; &gt;::const_iterator i = a.begin(); i != a.end(); ++i) {         Wt::Dbo::ptr&lt;News&gt; Article = *i;         Wt::WPanel *panel = new Wt::WPanel();         panel-&gt;setTitle(WString::fromUTF8(Article.get()-&gt;title));         panel-&gt;setCentralWidget(new Wt::WText(WString::fromUTF8(&quot;&lt;p&gt;\u0410\u0432\u0442\u043e\u0440:&quot;)+WString::fromUTF8(Article.get()-&gt;author)+&quot;&lt;\/p&gt;&lt;p&gt;&quot;+WString::fromUTF8(Article.get()-&gt;text)+&quot;&lt;\/p&gt;&quot;));\/\/\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u043b \u0432\u044b\u0432\u043e\u0434. \u0418\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438 \u043d\u043e\u0440\u043e\u0432\u0438\u0442 \u0432\u044b\u0432\u043e\u0434\u0438\u0442\u044c \u0440\u0443\u0441\u0441\u043a\u0438\u0439 \u0442\u0435\u043a\u0441\u0442 \u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u0432\u043e\u043f\u0440\u043e\u0441\u0430.         NewsTable-&gt;elementAt(j,0)-&gt;addWidget(panel);         NewsTable-&gt;elementAt(j,0)-&gt;setLoadLaterWhenInvisible(true);         j++;     }     transaction1.commit();      setStyleClass(&quot;container&quot;);     contentsStack = new Wt::WStackedWidget();     contentsStack-&gt;setStyleClass(&quot;container&quot;);     contentsStack-&gt;setPadding(48,Wt::Top);      NavBar = new WNavigationBar(this);     NavBar-&gt;setTitle(&quot;MyApp&quot;,&quot;http:\/\/localhost:8080&quot;);     NavBar-&gt;setResponsive(true);     NavBar-&gt;addStyleClass(&quot;container&quot;);     NavBar-&gt;setPositionScheme(Wt::Fixed);     LeftMenu=new WMenu(contentsStack,this);     NavBar-&gt;addMenu(LeftMenu);      LeftMenu-&gt;addItem(WString::fromUTF8(&quot;\u041d\u043e\u0432\u043e\u0441\u0442\u0438&quot;),NewsTable);      CreateArticle=new Wt::WTable(); \/\/\u0422\u0430\u0431\u043b\u0438\u0447\u043a\u0430 \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0441\u0442\u0438     Title=new Wt::WLineEdit(WString::fromUTF8(&quot;\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u043d\u043e\u0432\u043e\u0441\u0442\u0438&quot;)); \/\/\u0412\u0441\u044f\u043a\u0438\u0435 \u043f\u043e\u043b\u044f     Author=new Wt::WLineEdit(WString::fromUTF8(&quot;\u0410\u0432\u0442\u043e\u0440&quot;));     Text=new Wt::WTextArea(WString::fromUTF8(&quot;\u0422\u0435\u043a\u0441\u0442 \u043d\u043e\u0432\u043e\u0441\u0442\u0438&quot;));     AddNews=new Wt::WPushButton(WString::fromUTF8(&quot;\u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u043e\u0441\u0442\u044c&quot;));      CreateArticle-&gt;addStyleClass(&quot;container&quot;);      CreateArticle-&gt;elementAt(0,0)-&gt;addWidget(Title); \/\/\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0447\u043a\u0443     CreateArticle-&gt;elementAt(1,0)-&gt;addWidget(Author);     CreateArticle-&gt;elementAt(2,0)-&gt;addWidget(Text);     CreateArticle-&gt;elementAt(3,0)-&gt;addWidget(AddNews);      LeftMenu-&gt;addItem(WString::fromUTF8(&quot;\u0421\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u043e\u0441\u0442\u044c&quot;),CreateArticle); \/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434 Page::AddArticle \u043a \u0435\u0451 \u043d\u0430\u0436\u0430\u0442\u0438\u044e     AddNews-&gt;clicked().connect(this,&Page::AddArticle);      this-&gt;addWidget(contentsStack); }  void Page::AddArticle() {     Wt::Dbo::backend::Sqlite3 DataBase=WApplication::instance()-&gt;appRoot() + &quot;myapp.db&quot;;     DBSession.setConnection(DataBase); \/\/\u041f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f (\u0434\u043e\u043b\u0433\u043e \u0441 \u044d\u0442\u0438\u043c \u0431\u0438\u043b\u0441\u044f, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0441\u0442\u043e\u0438\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0451 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430, \u0430 \u043d\u0435 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438)     Wt::Dbo::Transaction transaction(DBSession); \/\/\u041f\u043e\u0432\u0442\u043e\u0440\u044e\u0441\u044c: \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0411\u0414 \u043d\u0443\u0436\u043d\u0430 \u0436\u0438\u0432\u0430\u044f \u0442\u0440\u0430\u043d\u0437\u0430\u043a\u0446\u0438\u044f.     News *a=new News(); \/\/\u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043d\u043e\u0432\u043e\u0441\u0442\u044c     a-&gt;title=Title-&gt;text().toUTF8();     a-&gt;author=Author-&gt;text().toUTF8();     a-&gt;text=Text-&gt;text().toUTF8();     Wt::Dbo::ptr&lt;News&gt; Article=DBSession.add(a); \/\/\u0417\u0430\u043d\u043e\u0441\u0438\u043c \u043d\u043e\u0432\u043e\u0441\u0442\u044c \u0432 \u0411\u0414 } <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/7cb\/dd7\/6fd\/7cbdd76fd50dd9b6c7fc1b3fff8dc94e.jpeg\"\/><br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage3\/f04\/cd6\/d8d\/f04cd6d8d4d0a7ee23ed611fb78d7dbd.jpeg\"\/><\/p>\n<p>  <b>P.S. <\/b>\u0415\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439. \u042f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0430\u043b \u0438\u0437\u0443\u0447\u0430\u0442\u044c Wt, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432\u043f\u043e\u043b\u043d\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0433\u0434\u0435-\u0442\u043e \u043d\u0435\u043f\u0440\u0430\u0432. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434, \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u0435.<br \/>  <b>P.P.S. <\/b>\u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e Wt, \u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0447\u0442\u043e \u0435\u0449\u0451 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043e \u043d\u0451\u043c \u0443\u0437\u043d\u0430\u0442\u044c, \u0438 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0431 \u044d\u0442\u043e\u043c! \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/209754\/\"> http:\/\/habrahabr.ru\/post\/209754\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e \u0441\u0435\u0431\u0435. \u042f \u0441\u0442\u0443\u0434\u0435\u043d\u0442 4 \u043a\u0443\u0440\u0441\u0430 \u041c\u0410\u0418 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u00ab\u042d\u0412\u041c, \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u044b, \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u0441\u0435\u0442\u0438\u00bb, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442 \u043d\u0430 \u0421++\/Qt. \u041e\u0447\u0435\u043d\u044c \u0434\u0430\u0432\u043d\u043e \u044f \u0445\u043e\u0442\u0435\u043b \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u0435\u0431-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435, \u043d\u043e \u0434\u043e \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0445 \u044f\u0437\u044b\u043a\u043e\u0432 \u0438 \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0439 \u0440\u0443\u043a\u0438 \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0434\u043e\u0445\u043e\u0434\u0438\u043b\u0438. \u041d\u0435\u0434\u0430\u0432\u043d\u043e \u043d\u0430 \u0425\u0430\u0431\u0440\u0435 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c <a href=\"http:\/\/habrahabr.ru\/post\/142585\/\">\u0441\u0442\u0430\u0442\u044c\u044f \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0432\u0435\u0431-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e C++ \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Wt<\/a>, \u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0431\u043b\u0438\u0436\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-209754","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209754","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=209754"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/209754\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=209754"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=209754"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=209754"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}