{"id":286340,"date":"2017-05-15T12:40:03","date_gmt":"2017-05-15T08:40:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=286340"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=286340","title":{"rendered":"\u0410\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 Qt \u0444\u043e\u0440\u043c \u0441 SQL \u0431\u0430\u0437\u043e\u0439 \u0434\u0430\u043d\u043d\u044b\u0445"},"content":{"rendered":"<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0432\\\u0438\u0437 SQL \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u0434 \u0441\u043b\u043e\u0436\u043d\u044b\u0439. \u0414\u043b\u044f \u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430\u0434\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Qt \u043f\u043e \u0447\u0430\u0441\u0442\u0438 QtGui, QtSql. \u0418 \u0445\u043e\u0442\u044f \u0431\u044b \u0441\u0440\u0435\u0434\u043d\u0435 C++.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/b5d\/699\/3af\/b5d6993afba84fbd9f333bdf4fdfa347.png\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0418\u0441\u0442\u043e\u0440\u0438\u044f<\/h2>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0442\u043e \u0440\u0430\u0437 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u043c \u043d\u0430 Qt. \u0411\u044d\u043a\u0435\u043d\u0434\u043e\u043c \u0431\u044b\u043b\u0430 \u0441\u0430\u043c\u0430\u044f \u043e\u0431\u044b\u0447\u043d\u0430\u044f SQL \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e \u0430\u0434\u0440\u0435\u0441\u043d\u0443\u044e \u043a\u043d\u0438\u0433\u0443. \u041d\u043e \u0442\u0430\u043c \u0431\u044b\u043b\u043e \u043e\u043a\u043e\u043b\u043e \u0441\u043e\u0442\u043d\u0438 \u0432\u0441\u044f\u043a\u0438\u0445 Qt \u0444\u043e\u0440\u043c \u0438 \u0434\u0438\u0430\u043b\u043e\u0433\u043e\u0432. \u0412\u0441\u0435 \u044d\u0442\u0438 \u0444\u043e\u0440\u043c\u044b \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043d\u0430 \u0421++. \u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e \u0431\u0435\u0440\u0451\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0431\u0430\u0437\u044b, \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442 \u0438\u0445 \u043f\u043e \u043f\u0440\u043e\u0441\u0442\u044b\u043c \u043f\u043e\u043b\u044f\u043c. \u0418 \u0437\u0430\u0442\u0435\u043c, \u043f\u0440\u0438 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0438 \u0444\u043e\u0440\u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0432 \u0431\u0430\u0437\u0443. <\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">\tForm::Form(QObject* parent)\t: QWidget(parent) \t{ \t\tQSqlQuery query; \t\tquery.prepare( &quot;SELECT firstname  &quot; \/\/ + \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \t\t\t\t\t\t\t\t  &quot; FROM persons WHERE id = ?&quot; );  \t\tconst bool right = query.exec() && query.first();  \t\tQ_ASSERT( right ); \/\/ \u041d\u0430\u043a\u043e\u0441\u044f\u0447\u0438\u043b \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435.  \t\tif( right ) \t\t{ \t\t\tui-&gt;firstnameEdit-&gt;setText( query.valie( 0 ).toString() ); \t\t\t\/* \u0418 \u0435\u0449\u0451 \u043f\u043e\u043b\u0441\u043e\u0442\u043d\u0438 \u043f\u043e\u043b\u0435\u0439 *\/ \t\t} \t}  \t~Form::Form() \t{ \t\tQSqlQuery query; \t\tquery.prepare( &quot;UPDATE persons SET firstname = :firstname &quot; \/\/ + \u0435\u0449\u0451 \u043c\u043d\u043e\u0433\u043e \u0432\u0441\u0435\u0433\u043e \t\t\t\t\t\t\t\t &quot; WHERE id = :id&quot; );  \t\tquery.bindValie( &quot;:firstname&quot;, ui-&gt;firstnameEdit-&gt;text() ); \t\t\/* \u041e\u043f\u044f\u0442\u044c \u043f\u043e\u043b\u0441\u043e\u0442\u043d\u0438 \u043f\u043e\u043b\u0435\u0439 *\/ \t\tconst bool right = query.exec();  \t\tQ_ASSERT( right ); \/\/ \u0421\u043d\u043e\u0432\u0430 \u043d\u0430\u043a\u043e\u0441\u044f\u0447\u0438\u043b \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0435. \t}  <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u0441\u0451 \u0431\u044b\u043b\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u043a\u0430\u043a\u043e\u0435 \u0442\u043e \u0432\u0440\u0435\u043c\u044f. \u041d\u043e \u043d\u0430\u0447\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u044f \u0447\u0442\u043e \u0442\u043e \u0442\u0443\u0442 \u043d\u0435 \u0442\u0430\u043a. \u0425\u043e\u0442\u044f \u0431\u044b \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e <em> &#8216;firstname&#8217;<\/em> \u0432 \u0437\u0430\u043f\u0440\u043e\u0441\u0430\u0445 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043e\u0441\u044c \u0434\u0432\u0430 \u0440\u0430\u0437\u0430. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e. \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 <em> &#8216;firstname&#8217;<\/em> \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e. \u041d\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u043d\u0435 \u0442\u043e. \u0412\u0440\u043e\u0434\u0435 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e \u0447\u0442\u043e \u0442\u043e \u0442\u0443\u0442 \u043d\u0430\u0434\u043e \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u044c\u043d\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c.<\/p>\n<p>  \u0418 \u0432\u043e\u0442, \u0434\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u043c\u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u044b\u0445 \u0444\u043e\u0440\u043c, \u0441 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043a\u0443\u0447\u0435\u0439 \u043f\u043e\u043b\u0435\u0439. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0433\u0440\u0443\u0441\u0442\u044c \u043e\u0442 \u043a\u043e\u0434\u0430 \u0432\u044b\u0448\u0435 \u043d\u0430\u043a\u043e\u043f\u0438\u043b\u0430\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0430\u044f. \u0420\u0435\u0448\u0438\u043b \u0432\u043e\u043f\u043b\u043e\u0442\u0438\u0442\u044c \u0441\u0432\u043e\u0438 \u0441\u0430\u043c\u044b\u0435 \u0441\u043c\u0435\u043b\u044b\u0435 \u043c\u0435\u0447\u0442\u044b \u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u044f. <\/p>\n<p>  \u041c\u0435\u0447\u0442\u044b:<\/p>\n<ul>\n<li>\u041a\u043e\u043b\u043e\u043d\u043a\u0438 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u0432\u0432\u043e\u0434\u0430 <em>(&#8216;firstname&#8217;)<\/em> \u0438 \u0438\u043c\u0435\u043d\u0430 \u0442\u0430\u0431\u043b\u0438\u0446 \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c\u0441\u044f 1 \u0440\u0430\u0437. \u0412 \u0438\u0434\u0435\u0430\u043b\u0435 \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c property \u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 (QtDesigner).<\/li>\n<li>\u0420\u0443\u0442\u0438\u043d\u043d\u044b\u0435 SQL \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u0434\u0435\u043b\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u044d\u0442\u0438\u0445 property \u0441 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u043c \u043a\u043e\u0434\u0430. <\/li>\n<li>\u0424\u043e\u0440\u043c\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0434 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0439 \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0438 \u0441\u0430\u043c\u043e\u0439 \u0444\u043e\u0440\u043c\u044b. \u041f\u0440\u043e\u0441\u0442\u043e\u0435 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438\u0437 \u0411\u0414 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043c\u0435\u0441\u0442\u0430 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0444\u043e\u0440\u043c.<\/li>\n<li>\u041a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0444\u043e\u0440\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446.<\/li>\n<li>\u0414\u043e\u043b\u0436\u043d\u043e \u043e\u0441\u0442\u0430\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u00ab\u0433\u0440\u0443\u0441\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430\u00bb \u0438\u0437 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u044b\u0448\u0435. \u041e\u043d \u043c\u043e\u0433 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u043e \u0432\u0441\u044f\u043a\u0438\u0445 \u043d\u0435\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f\u0445. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0441\u0451 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u043e\u0442\u0448\u043b\u0438\u0444\u043e\u0432\u0430\u0442\u044c \u0432 \u043b\u0443\u0447\u0448\u0438\u0445 \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u044f\u0445 \u041e\u041e\u041f. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u044f \u043f\u043b\u043e\u0445\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u043b \u0441\u0435\u0431\u0435 \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e. \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0431\u044b\u043b \u043f\u043e\u043b\u0443\u0447\u0435\u043d. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0430\u0432\u0435\u0432\u0430\u0435\u0442 \u043d\u0430 \u043c\u0435\u043d\u044f \u043d\u0435 \u043c\u0435\u043d\u044c\u0448\u0443\u044e \u0433\u0440\u0443\u0441\u0442\u044c \u0447\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0448\u0435. \u041d\u043e \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u041e\u043d \u0442\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0447\u0442\u043e \u0443\u0441\u043f\u0435\u043b \u0437\u0430\u0431\u044b\u0442\u044c \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u0410 \u044f \u0441 \u044d\u0442\u0438\u043c \u043a\u043e\u0434\u043e\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0442\u0430\u043a. \u0414\u0435\u043b\u0430\u043b \u0444\u043e\u0440\u043c\u0443 \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043f\u043e\u043b\u044f\u043c\u0438 \u0432\u0432\u043e\u0434\u0430 \u043d\u0430 \u043d\u0435\u0439. \u0418 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u043b \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 \u043f\u043e\u043b\u044e property, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u0438\u043c\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0432 \u0411\u0414, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u041f\u043e\u0442\u043e\u043c, \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u0444\u043e\u0440\u043c\u044b, \u043f\u0438\u0441\u0430\u043b \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0442\u0438\u043f\u0430 <em>setupForm( \u00abpersons\u00bb );<\/em> \u0438 <em>fillForm( dbID );<\/em> \u0422.\u0435. \u043e\u0431\u0440\u0430\u0437\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0444\u043e\u0440\u043c\u0435 \u00ab\u043d\u0430\u0441\u0442\u0440\u043e\u0439 \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b &#8216;persons&#8217; \u00bb \u0438 \u00ab\u0437\u0430\u043f\u043e\u043b\u043d\u0438 \u0435\u0451 \u0434\u0430\u043d\u043d\u044b\u043c \u0438\u0437 \u0441\u0442\u0440\u043e\u043a\u0438 \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u0439\u0441\u044f \u043f\u043e\u0434 \u043a\u043b\u044e\u0447\u043e\u043c \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 dbID\u00bb. \u0424\u043e\u0440\u043c\u0430 \u0434\u0435\u043b\u0430\u043b\u0430 \u0447\u0442\u043e \u0435\u0439 \u0433\u043e\u0432\u043e\u0440\u044f\u0442. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u0431\u044b\u043b\u0438 \u0443\u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0431\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430, \u0433\u0434\u0435 \u044d\u0442\u0438 \u043c\u0435\u0442\u043e\u0434\u044b \u0438 \u0431\u044b\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u044b.<\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0435\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u043e\u0441\u0442\u043e\u044f\u043b\u0430 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0434\u0432\u0443\u0445 \u0441\u0442\u0440\u043e\u043a \u0438 \u043e\u0431\u0449\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c\u043e\u0433\u043e QtCreator-\u043e\u043c. \u0424\u043e\u0440\u043c\u0430 \u0441 \u0441\u043e\u0442\u043d\u0435\u0439 \u043f\u043e\u043b\u0435\u0439, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u043a\u043e\u0434\u0430 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u0430\u0436\u0435 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435. \u041d\u043e \u0438\u043d\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <em>fillForm()<\/em> \u0435\u0449\u0451 \u0440\u0430\u0437. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044f \u0438\u0437 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 SQL \u0442\u0430\u0431\u043b\u0438\u0446. \u0422\u0438\u043f\u0430 <em>fillForm( anotherRecordId, \u00abaddress\u00bb ).<\/em> <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0439 \u043a\u043e\u0434 \u0438\u0437 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u0432\u044f\u0449\u0451\u043d\u043d\u044b\u043c. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u043d\u043e\u0432\u043e. \u0410 \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u0432\u0441\u0435 \u043c\u044b \u043d\u0430\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f \u043e\u043f\u044b\u0442\u0430. \u041e\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043b\u0443\u0447\u0448\u0435 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0433\u043e. \u0412\u0435\u0441\u044c \u043a\u043e\u0434 \u0431\u044b\u043b \u043e\u0444\u043e\u0440\u043c\u043b\u0435\u043d \u0432 \u0432\u0438\u0434\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438. \u0418 <a href=\"https:\/\/github.com\/stanislav888\/AddressBook\">\u0437\u0430\u043b\u0438\u0442 \u043d\u0430 github<\/a>. \u0414\u0430\u043b\u0435\u0435 \u0437\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0443\u0442 \u043c\u043d\u043e\u0433\u043e\u0441\u043b\u043e\u0432\u043d\u044b\u0435 \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a \u043e\u043d\u043e \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. <\/p>\n<p>  <\/p>\n<h2>\u0422\u0435\u0441\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/719\/45b\/7f4\/71945b7f40e44e4c9815180d0384f25b.png\" alt=\"\u041a\u043e\u0442 \u0438 \u0451\u0436\u0438\u043a\"\/><\/p>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u043d\u0430\u0434\u043e \u0438\u043c\u0435\u0442\u044c QtCreator c Qt \u043d\u0435 \u043d\u0438\u0436\u0435 5.0. \u041b\u0438\u0447\u043d\u043e \u044f \u0441\u043e\u0431\u0438\u0440\u0430\u043b \u043f\u0440\u043e\u0435\u043a\u0442 \u0441 Qt 5.5.0 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u043e\u043c gcc 5.3.1. \u0425\u043e\u0442\u044f \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u0438 \u0434\u0430\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u0430 Qt 4.8.1. \u041e\u0434\u043d\u0430\u043a\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u00ab\u0441\u043f\u0435\u0446\u044d\u0444\u0444\u0435\u043a\u0442\u044b\u00bb \u0434\u0435\u043b\u0430\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0442\u0430\u043c \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u043e\u0439.   <\/p>\n<p>  \u041d\u0430\u0447\u0430\u043b\u044c\u043d\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u0430:<\/p>\n<ol>\n<li>\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 <em>\u00abgit clone <a href=\"https:\/\/github.com\/stanislav888\/AddressBook.git\">github.com\/stanislav888\/AddressBook.git<\/a>\u00bb<\/em><\/li>\n<li>\u041c\u0435\u043d\u044f\u0435\u0442\u0435 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 <em>\u00abcd AddressBook\u00bb<\/em><\/li>\n<li>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439\u0442\u0435 \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044c <em>\u00abgit submodule init\u00bb<\/em><\/li>\n<li>\u041f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442\u0435 \u043a\u043e\u0434 \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044f \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 <em>\u00abgit submodule update\u00bb<\/em><\/li>\n<li>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0435 \u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0435\u043a\u0442<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<\/li>\n<li>\u0415\u0441\u043b\u0438 \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u043a\u043d\u043e \u0432\u044b\u0431\u043e\u0440\u0430\\\u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430 \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0447\u0442\u043e \u0437\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430. \u0414\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0435\u0441\u0442\u044c \u043a\u043d\u043e\u043f\u043e\u0447\u043a\u0430 \u00abFill test data\u00bb<\/li>\n<li>\u0423\u0434\u0430\u043b\u044f\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e \u0411\u0414 \u043a\u043d\u043e\u043f\u043a\u043e\u0439 \u00abDelete DB file\u00bb<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u044b \u0441\u0430\u043c\u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u0435 \u043f\u043e\u043b\u044f \u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<ol>\n<li>\u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>AddressBookMainWindow::createDb()<\/em> \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043b\u044e\u0431\u043e\u0439, \u043d\u043e\u0432\u044b\u0439 \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u043a \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00abpersons\u00bb<em>(PERSONS_TABLE_NAME)<\/em>. \u0427\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 <em>&#8216; &lt;&lt; \u00abmiddlename TEXT\u00bb &#8216;<\/em> \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e \u0441\u0432\u043e\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c \u0441\u0442\u043e\u043b\u0431\u0446\u0430.<\/li>\n<li>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b <em>addressbookmainwindow.ui<\/em> \u0432 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0435 \u0444\u043e\u0440\u043c<\/li>\n<li>\u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0442\u0443\u0434\u0430 \u0432\u0438\u0434\u0436\u0435\u0442 \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043f\u043e\u043b\u044f. \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 <em>QLineEdit.<\/em><\/li>\n<li>\u0423 \u043d\u043e\u0432\u043e\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0441\u043e\u0437\u0434\u0430\u0439\u0442\u0435 property \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abc\u00bb(column), \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c-\u0438\u043c\u0435\u043d\u0435\u043c \u043d\u043e\u0432\u043e\u0433\u043e \u0441\u0442\u043e\u043b\u0431\u0446\u0430. \u0421\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043f.1<\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0412\u0430\u0441 \u043e\u043f\u044f\u0442\u044c \u0434\u043e\u043b\u0436\u043d\u044b \u0441\u043f\u0440\u043e\u0441\u0438\u0442\u044c \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0431\u0430\u0437\u044b. \u0415\u0441\u043b\u0438 \u043d\u0435\u0442. \u0423\u0434\u0430\u043b\u044f\u0435\u0442\u0435 \u0431\u0430\u0437\u0443 \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u043d\u043e\u0432\u0430<\/li>\n<li>\u0412\u0438\u0434\u0438\u0442\u0435 \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435. \u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0442\u0430\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u043e\u043c. \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u043f\u043e\u043b\u0435 \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u0441\u043b\u0435\u0432\u0430. \u041d\u0430 \u0434\u0440\u0443\u0433\u0443\u044e \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e<\/li>\n<li><strong>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f \u0438\u0437 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b.<\/strong> <br \/>  \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 <em>&#8216; &lt;&lt; \u00abpostcode TEXT\u00bb &#8216;<\/em> \u0432 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00abaddress\u00bb<em>(ADDRESS_TABLE_NAME)<\/em> \u0442\u0430\u043c \u0436\u0435.<\/li>\n<li>\u041f\u043e\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043e\u043f\u044f\u0442\u044c <em>QLineEdit<\/em> \u043d\u0430 \u0444\u043e\u0440\u043c\u0443 <em>addressdialog.ui<\/em> property \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u00abc\u00bb \u043e\u043f\u044f\u0442\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u2014 \u0438\u043c\u0435\u043d\u0435\u043c \u043a\u043e\u043b\u043e\u043d\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u043b\u0438 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435 <\/li>\n<li>\u0422\u0430\u043a \u0436\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0444\u0430\u0439\u043b \u0441 \u0431\u0430\u0437\u043e\u0439 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443. \u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u043d\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b<\/li>\n<li>\u041d\u0430 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435 \u043a\u043b\u0438\u043a\u0430\u0435\u0442\u0435 \u00abChoose address\u00bb \u0438 \u0432\u0438\u0434\u0438\u0442\u0435 \u0434\u0438\u0430\u043b\u043e\u0433 \u0441 \u0432\u0430\u0448\u0438\u043c \u043d\u043e\u0432\u044b\u043c <em>QLineEdit<\/em>. \u041e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0442\u0430\u043a \u0436\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u0431\u0430\u0437\u0443 \u043a\u0430\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044f<\/li>\n<li>\u0417\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 \u0430\u0434\u0440\u0435\u0441 \u0441 \u0432\u0430\u0448\u0438\u043c \u043d\u043e\u0432\u044b\u043c \u043f\u043e\u043b\u0435\u043c \u0438 \u0432\u044b\u0431\u0435\u043b\u0438\u0442\u0435 \u0435\u0433\u043e(\u00abSelect address\u00bb)<\/li>\n<li>\u0417\u0430\u043a\u0440\u043e\u0439\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443<\/li>\n<li>\u041e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 <em>addressbookmainwindow.ui<\/em> \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0438 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u0442\u0430\u043a\u043e\u0435 \u0436\u0435 \u043f\u043e\u043b\u0435 \u0441 \u0442\u0435\u043c \u0436\u0435 property \u0432 \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b<\/li>\n<li>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 property \u00abt\u00bb(table) \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u00abaddress\u00bb<\/li>\n<li>\u0414\u0430\u043b\u0435\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00abaddress\u00bb \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u043e\u0440\u043c\u0435. \u0412 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>void AddressBookMainWindow::updateForm()<\/em>. \u0423\u0436\u0435 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 <em>\u00abm_widgetHelpers.fillForm( addressId, ADDRESS_TABLE_NAME );\u00bb<\/em><\/li>\n<li>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c. \u041d\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c\u0441\u044f \u0432 \u043e\u0431\u043e\u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0445<\/li>\n<\/ol>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0445 \u043e\u043f\u044b\u0442\u043e\u0432 \u0441 <em>QLineEdit<\/em> \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0442\u0438\u043f\u0430 <em>QSpinBox, QDateEdit<\/em> \u0438 \u0442.\u043f. \u0412\u0441\u0451 \u0432 \u0442\u043e\u0439 \u0436\u0435 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u0434\u0430\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u044b \u0430\u0441\u0441\u0435\u0440\u0442\u043e\u0432.  <\/p>\n<p>  <\/p>\n<h2>\u041e\u0431\u0437\u043e\u0440 \u043a\u043e\u0434\u0430<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/d35\/ab2\/0a6\/d35ab20a60494975ad91b004777c0ed5.png\"\/><\/p>\n<h3>\u0424\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<p>  <a href=\"https:\/\/github.com\/stanislav888\/AddressBook.git\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0444\u0430\u0439\u043b\u044b<\/a><\/p>\n<ul>\n<li><strong>\u041f\u0430\u043f\u043a\u0430 common.<\/strong> \u0412\u0441\u0435 \u043e\u0431\u0449\u0438\u0435 \u0444\u0430\u0439\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0442\u0430\u0449\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u00ab\u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0433\u043e\u00bb \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430. \u0412\u044b\u0434\u0435\u043b\u0435\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/stanislav888\/WidgetsHelpers\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442<\/a><\/li>\n<li><strong>common\/widgethelpers.*<\/strong> \u00ab\u041f\u043e\u043c\u043e\u0448\u043d\u0438\u043a\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u00bb. \u0418\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u00ab\u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u0430\u00bb \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c. <\/li>\n<li><strong>setupdialog.*<\/strong> \u0434\u0438\u0430\u043b\u043e\u0433 \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u0433\u0434\u0435 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445<\/li>\n<li><strong>addressbookmainwindow.*<\/strong> \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0422\u0430\u043c \u0436\u0435 \u043a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0411\u0414.<\/li>\n<li><strong>addressdialog.*<\/strong> \u0444\u043e\u0440\u043c\u0430 \u0432\u044b\u0431\u043e\u0440\u0430 \u0430\u0434\u0440\u0435\u0441\u0430.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0421\u043a\u0430\u0436\u0443 \u0441\u0440\u0430\u0437\u0443. \u041d\u0435 \u0445\u043e\u0442\u0435\u043b \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c\u0438. \u042f \u0434\u0435\u043b\u0430\u043b \u043a\u043e\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0441\u0442\u0430\u0442\u044c \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u043e\u0433\u0434\u0430 \u0442\u0430\u043c \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0431\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c <em>WidgetHelpers<\/em> \u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u043e\u0432. <\/p>\n<p>  <\/p>\n<h3>\u041a\u043b\u0430\u0441\u0441\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/h3>\n<p>  <\/p>\n<h4>WidgetHelpers<\/h4>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/e50\/8d6\/5f0\/e508d65f06454381ac872309d4422e4c.png\" alt=\"\u041a\u043e\u0442 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u043d\u0430 \u0441\u0442\u0440\u043e\u0439\u043a\u0435\"\/><\/p>\n<p><em>WidgetHelpers<\/em> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u0435\u0441\u044c \u00ab\u0432\u043e\u043b\u0448\u0435\u0431\u043d\u044b\u0439\u00bb \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b. <\/p>\n<ul>\n<li><a name=\"setupForm\"><\/a><strong>void setupForm( QWidget* fornPointer, const QString&#038; defaultTableName );<\/strong>\n<p>  \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442 \u043f\u043e\u043b\u044f \u0444\u043e\u0440\u043c\u044b, \u0443 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d property <em>COLUMN_NAME_PROP<\/em> \u043d\u0430 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0411\u0414 \u043f\u043e\u0441\u043b\u0435 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0444\u043e\u043a\u0443\u0441\u0430 \u0432\u0432\u043e\u0434\u0430. <\/p>\n<p>  <em>fornPointer<\/em> \u2014 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0444\u043e\u0440\u043c\u0443 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0434\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0441 \u043a\u043b\u0430\u0441\u0441\u043e\u043c \u0444\u043e\u0440\u043c\u044b, \u043a\u0430\u043a \u0437\u0430 \u0441\u0447\u0451\u0442 \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u044f, \u0442\u0430\u043a \u0438 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u0438. \u0417\u0434\u0435\u0441\u044c \u0434\u043b\u044f \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u0444\u043e\u0440\u043c\u0443 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c, \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u044f\u0432\u043d\u043e. <\/p>\n<p>  <em>defaultTableName<\/em> \u2014 SQL \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u00ab\u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00bb. \u0415\u0441\u043b\u0438 \u0443 \u043f\u043e\u043b\u044f \u043d\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 property \u00abt\u00bb(<em>TABLE_NAME_PROP<\/em>), \u0442\u043e <em>defaultTableName<\/em> \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u044d\u0442\u043e property. <\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0443 \u0444\u043e\u0440\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043a\u0430\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u00ab\u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00bb. \u041a\u043e\u0442\u043e\u0440\u0443\u044e \u043d\u0435 \u043d\u0430\u0434\u043e \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0432 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u0430.<\/p>\n<\/li>\n<li><strong>void fillForm(const QVariant&#038; tableRecordId, const QString &#038;tableName \/*= QString::null *\/)<\/strong>\n<p>  \u0417\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043f\u043e\u043b\u044f \u0432\u0432\u043e\u0434\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b. \u041d\u0430\u0434\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c 1 \u0440\u0430\u0437 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 \u043a\u0430\u0436\u0434\u043e\u0439 SQL \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u043d\u0430 \u0444\u043e\u0440\u043c\u0435. <\/p>\n<p>  <em>tableName<\/em> -\u0438\u043c\u044f SQL \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043f\u043e\u043b\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u0444\u043e\u0440\u043c\u0435. \u0415\u0441\u043b\u0438 \u043e\u043d\u043e \u043d\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u044f\u0432\u043d\u043e. \u0422\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044f \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00ab\u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00bb \u0441\u043c. <em><a href=\"#setupForm\">defaultTableName<\/a><\/em> \u0432\u044b\u0448\u0435. <\/p>\n<p>  <em>tableRecordId<\/em> \u2014 ID \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435, \u0434\u0430\u043d\u043d\u044b\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0444\u043e\u0440\u043c\u0435. \u0415\u0441\u043b\u0438 \u0442\u0443\u0434\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e QVariant(). \u0422.\u0435. \u00abnull\u00bb. \u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0430\u043c \u0437\u0430\u043f\u0440\u043e\u0441 \u043a \u0431\u0430\u0437\u0435. \u0422\u043e \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u043f\u043e\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u044f\u0442\u0441\u044f \u0438 \u0437\u0430\u043b\u043e\u0447\u0430\u0442\u0441\u044f.<\/p>\n<\/li>\n<li><strong>QVariant getFieldValie(const QString &#038;tableName, const QString &#038;colimnName) const;<\/strong>\n<p>  \u0418\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u044d\u0448\u0430. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0438\u0437\u0432\u043b\u0435\u0447\u0435\u043d\u0438\u044f foreign key \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u043d\u043e\u0432\u044b\u0445 \u0437\u0430\u043f\u0438\u0441\u0435\u0439 \u0432 \u043a\u044d\u0448. \u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u0430\u043a\u0438\u0445 \u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0445 \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e. \u0411\u0435\u0437 \u0443\u0447\u0430\u0441\u0442\u0438\u044f <em>fillForm()<\/em>.<\/p>\n<\/li>\n<li><strong>QSqlRecord addRecord(const QString &#038;tableName, const QVariant &#038;recordId);<\/strong>\n<p>  \u0414\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0435\u0439 \u0432\u0432\u043e\u0434\u0430 \u0432 \u043a\u044d\u0448 <em>m_tablesRecords.<\/em> \u041e\u0431\u044b\u0447\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0438\u0437 <em>fillForm().<\/em> \u041c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u044f\u0432\u043d\u043e, \u043a\u043e\u0433\u0434\u0430 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>recordId<\/em>, \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <em>getFieldValie()<\/em> \u0418 \u043d\u0435 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f <em>fillForm().<\/em><\/p>\n<\/li>\n<li><strong>void setAdditionalDisableWidgets( const QWidgetList &#038;widgets );<\/strong>\n<p>  \u0417\u0430\u0434\u0430\u0451\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u043c\u0438 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u044d\u0442\u043e \u043a\u043d\u043e\u043f\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0430\u043c\u0438 \u043f\u043e \u0441\u0435\u0431\u0435 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445, \u043d\u043e \u043d\u0435 \u0438\u043c\u0435\u044e\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043f\u0440\u0438 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435.<\/p>\n<\/li>\n<li>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 <strong>COLUMN_NAME_PROP, <em>TABLE_NAME_PROP<\/em>.<\/strong>\n<p>  \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0438\u043c\u0435\u043d\u0430 property \u0432\u0438\u0434\u0436\u0435\u0442\u043e\u0432, \u0433\u0434\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0438\u043c\u044f \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445. \u0415\u0441\u043b\u0438 \u0432\u0438\u0434\u0436\u0435\u0442 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 <em>COLUMN_NAME_PROP<\/em> \u0437\u043d\u0430\u0447\u0438\u0442 \u043e\u043d \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u043c\u0438. \u0418 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u043f\u043e\u043a\u043e\u0439\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043f\u043e-\u0441\u0432\u043e\u0435\u043c\u0443. \u041a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u0430 \u0432\u044b\u0431\u0440\u0430\u043d\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c. \u041c\u0435\u043d\u044c\u0448\u0435 \u0431\u0443\u043a\u0432 \u0432 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0438 property \u043c\u0435\u043d\u044c\u0448\u0435 \u043f\u0438\u0441\u0430\u043d\u0438\u043d\u044b \u0438 \u043e\u0448\u0438\u0431\u043e\u043a.<\/li>\n<\/ul>\n<p>  \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0444\u043e\u0440\u043c\u044b \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0430\u0431\u043b\u0438\u0446 <em>AddressBookMainWindow::updateForm()<\/em>. \u0422\u0430\u043a\u043e\u0439 \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0437\u043e\u0432\u0430 <em>WidgetHelpers::setupForm()<\/em><\/p>\n<h4>AddressBookMainWindow<\/h4>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/764\/60a\/98e\/76460a98eb844974aac98bfcad904562.png\"\/><\/p>\n<p><em>AddressBookMainWindow<\/em> \u2014 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043e\u043a\u043d\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0438\u0449\u0435\u0442 \u0431\u0430\u0437\u0443. \u0415\u0441\u043b\u0438 \u043d\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442, \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0433\u0434\u0435 \u0444\u0430\u0439\u043b \u0441 \u0431\u0430\u0437\u043e\u0439. \u0415\u0441\u043b\u0438 \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u0444\u0430\u0439\u043b, \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0431\u0430\u0437\u0443 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u0432 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438. \u0421\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443 \u0441 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430\u043c\u0438 \u0430\u0434\u0440\u0435\u0441\u043d\u043e\u0439 \u043a\u043d\u0438\u0433\u0438 \u0441\u043b\u0435\u0432\u0430 \u0438 \u0434\u0435\u0442\u0430\u043b\u0438 \u043f\u043e \u043a\u0430\u0436\u0434\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441\u043f\u0440\u0430\u0432\u0430. \u0422\u0430\u0431\u043b\u0438\u0446\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 <em>QSqlTableModel<\/em> \u043a\u0430\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445. \u0424\u043e\u0440\u043c\u0430 \u0436\u0435 \u0431\u0435\u0440\u0451\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0437 \u0431\u0430\u0437\u044b \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b <em>WidgetHelpers<\/em>, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442 \u0442\u0430\u043a \u0436\u0435. <em>QSqlTableModel<\/em> \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0431\u0430\u0437\u0443. \u0421\u0442\u0440\u0430\u043d\u043d\u043e \u0447\u0442\u043e \u043d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0440\u0430\u0437\u0434\u0435\u043b\u044c\u043d\u043e\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0438 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u043e\u043b\u0435\u0439. <em>QSqlTableModel<\/em> \u0438\u043d\u043e\u0433\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043e\u0448\u0438\u0431\u043a\u0430\u043c\u0438. \u041f\u043e\u0442\u043e\u043c, \u0443 \u043d\u0435\u0433\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043b\u044e\u043d\u0443\u0442\u044c \u0438 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f <em>QSqlQueryModel.<\/em> \u041a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442, \u043d\u043e \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0439 \u0443 \u043d\u0435\u0433\u043e \u043d\u0435\u0442. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f. \u0418 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043f\u043e\u043b\u0435\u0439 \u0432 \u043f\u0440\u0430\u0432\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u043d\u0443\u0436\u0435\u043d. \u0414\u043b\u044f \u0442\u0435\u0445 \u043a\u0442\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e \u0445\u043e\u0447\u0435\u0442 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 <em>QSqlTableModel(m_personsModelPtr)<\/em>. <em>WidgetHelpers(m_widgetHelpers)<\/em> \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u0442 \u0441\u0438\u0433\u043d\u0430\u043b <em>dataChanged( QString tableName, QString columnName, QVariant id, QVariant value );<\/em> \u0425\u043e\u0442\u044f \u0442\u0443\u0442 \u0435\u0449\u0451 \u043d\u0443\u0436\u043d\u0430 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 <em>WidgetHelpers::saveDataSlot()<\/em>. \u0417\u0434\u0435\u0441\u044c \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u0437\u0430 \u043d\u0435\u043d\u0430\u0434\u043e\u0431\u043d\u043e\u0441\u0442\u044c\u044e. \u0422\u0430\u043a \u0436\u0435 \u043d\u0430 \u0444\u043e\u0440\u043c\u0435 \u0435\u0441\u0442\u044c \u0434\u0440\u0443\u0433\u0430\u044f \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u044c. \u041a\u043e\u043c\u0431\u043e\u0431\u043e\u043a\u0441 <em>ui-&gt;countryCombo.<\/em> \u041d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0438 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u0437 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 SQL \u0442\u0430\u0431\u043b\u0438\u0446. \u0417\u0434\u0435\u0441\u044c \u044d\u0442\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0430 \u00abcountry\u00bb<em>(COUNTRY_TABLE_NAME)<\/em> \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u0447\u0435\u0440\u0435\u0437 \u00abaddress\u00bb<em>(ADDRESS_TABLE_NAME)<\/em>. \u041e\u0431\u044b\u0447\u043d\u043e \u043e\u043d \u0441\u043a\u0440\u044b\u0442 \u043e\u0442 \u043f\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0433\u043b\u0430\u0437 \u0442.\u043a. \u043c\u0435\u043d\u044f\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0443 \u0432\u043d\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0430\u0434\u0440\u0435\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u041a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0439\u0442\u0435 \u0438 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 <em>(ui-&gt;countryCombo-&gt;hide(); )<\/em>.  <\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0446\u0435\u043f\u0442\u0443\u0430\u043b\u044c\u043d\u043e, \u0434\u0430\u043d\u043d\u043e\u0435 \u043e\u043a\u043d\u043e<em>(AddressBookMainWindow)<\/em> \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 <em>WidgetHelpers.<\/em> \u041d\u043e \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 Qt \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442 \u0421++. \u0418 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043c\u043d\u043e\u0433\u043e \u0433\u0440\u0430\u0431\u043b\u0435\u0439 \u0434\u043b\u044f \u0436\u0435\u043b\u0430\u044e\u0449\u0438\u0445 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435\u043c\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044f\u043c\u0438 \u044f\u0437\u044b\u043a\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u0438 \u0434\u0430\u043b\u0435\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u0430\u0433\u0440\u0435\u0433\u0430\u0446\u0438\u044f, \u0447\u0442\u043e \u0431\u044b \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c \u0438 \u0431\u0435\u0437 \u0442\u043e\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u043a\u043e\u0434. \u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430. \u0417\u043d\u0430\u0447\u0438\u0442 \u0432\u044b \u0436\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u0438 \u0432\u044b\u0445\u043e\u0434 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u0438\u0434\u0438\u0442\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u0443\u0440\u043d\u043e\u0433\u043e. \u0417\u043d\u0430\u0447\u0438\u0442 \u043f\u043e\u043a\u0430 \u043e\u0431 \u044d\u0442\u043e\u043c \u0434\u0443\u043c\u0430\u0442\u044c \u043d\u0435 \u0441\u0442\u043e\u0438\u0442. \u041a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0438 \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e.<\/p>\n<p>  <\/p>\n<h4>AddressDialog<\/h4>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/142\/958\/f8c\/142958f8c77e4091b3a922f989ce4644.png\"\/><\/p>\n<p><em>AddressDialog<\/em> \u2014 \u0434\u0438\u0430\u043b\u043e\u0433 \u0432\u044b\u0431\u043e\u0440\u0430 \u0430\u0434\u0440\u0435\u0441\u0430 \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430. \u0420\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u0438 <em>AddressBookMainWindow.<\/em> \u041d\u043e \u043d\u0435 \u0441\u0442\u0430\u043b \u0432\u044b\u043d\u043e\u0441\u0438\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u0432\u0435\u0441\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u043b\u0435\u0432\u043e\u0439 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u0432 <em>WidgetHelpers.<\/em> \u0422\u0430\u0431\u043b\u0438\u0446\u044b \u043f\u043e\u043a\u0430 \u043d\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0448\u0435\u0439 \u0446\u0435\u043b\u044c\u044e. \u0410 \u0432\u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u043c\u0438 \u0432\u0432\u043e\u0434\u0430 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0436\u0435.<\/p>\n<p>  <\/p>\n<h3>\u041a\u0430\u043a \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u0445<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/7b9\/3f9\/9fe\/7b93f99fed9845c4840832daa08d75f9.png\"\/><\/p>\n<p>\u041a\u0430\u043a \u0443\u0436\u0435 \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438 \u043f\u044b\u0442\u043b\u0438\u0432\u044b\u0435 \u0443\u043c\u044b. \u0412 <em>WidgetHelpers<\/em> \u0435\u0441\u0442\u044c \u0434\u0432\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>static void setWidgetValie(const QVariant &#038;valie, QObject * const inputBox);<\/strong> \u0438 <strong>static QVariant getWidgetValie(const QObject* const sourceBox);<\/strong> \u043e\u043d\u0438 \u0431\u0435\u0440\u0443\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u0437 \u043b\u044e\u0431\u043e\u0433\u043e \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0438 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u043b\u044e\u0431\u043e\u0439 \u0432\u0438\u0434\u0436\u0435\u0442, \u0433\u0434\u0435 \u044d\u0442\u043e \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u043c\u0438 \u0442\u0438\u043f\u0430 <em>QLineEdit, QSpinBox<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043e\u0442 Qt. \u042d\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u00ab\u0441\u0435\u0442\u0442\u0435\u0440\u044b\u00bb \u0438 \u00ab\u0433\u0435\u0442\u0442\u0435\u0440\u044b\u00bb \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u043a <em>\u00abUSER\u00bb<\/em>. \u0414\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430, \u0432 \u0444\u0430\u0439\u043b\u0435 <em>\u00abqlineedit.h\u00bb<\/em> \u0435\u0441\u0442\u044c \u0441\u0442\u0440\u043e\u0447\u043a\u0430 <em>\u00abQ_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true)\u00bb<\/em> \u0415\u0441\u0442\u044c \u0434\u0430\u0436\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0447\u0435\u0433\u043e \u044d\u0442\u043e \u0437\u0430\u043a\u043b\u0438\u043d\u0430\u043d\u0438\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442. <\/p>\n<p>  <\/p>\n<p>\u041a\u0440\u043e\u043c\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u0435\u0441\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u043b\u0443\u0447\u0430\u0439 <em>QComboBox.<\/em> <em>\u00abQ_PROPERTY(QString currentText READ currentText WRITE setCurrentText NOTIFY currentTextChanged USER true)\u00bb<\/em>. \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0442\u0443\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e \u043d\u0435\u0442. \u041d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u043c\u0431\u043e\u0431\u043e\u043a\u0441\u044b, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0438\u0437 \u0411\u0414. \u041d\u0430\u043c \u0431\u044b\u043b\u043e \u0431\u044b \u0443\u0434\u043e\u0431\u043d\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e \u0432\u0442\u043e\u0440\u0438\u0447\u043d\u043e\u043c\u0443 \u043a\u043b\u044e\u0447\u0443 \u0438\u0437 \u0411\u0414, \u0430 \u043d\u0435 \u043f\u043e \u0441\u0442\u0440\u043e\u043a\u0435 \u0432\u0438\u0434\u0438\u043c\u043e\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0442\u0443\u0442 \u043b\u043e\u0433\u0438\u043a\u0430 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0430. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u043a\u043b\u044e\u0447\u0443 \u0438\u0437 \u0411\u0414. \u0445\u0440\u0430\u043d\u044f\u0449\u0435\u043c\u0443\u0441\u044f \u0432 <em>UserRole<\/em> \u043c\u043e\u0434\u0435\u043b\u0438 \u043a\u043e\u043c\u0431\u043e\u0431\u043e\u043a\u0441\u0430.   <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u043b\u0443\u0447\u0430\u0439 \u0441 \u0433\u0440\u0443\u043f\u043f\u043e\u0439 <em>QRadioButton -\u043e\u0432.<\/em> \u0422\u0430\u043a\u043e\u0435 \u043d\u0430 \u0444\u043e\u0440\u043c\u0430\u0445 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c \u0438\u0437 \u0411\u0414. \u0418 \u043b\u0435\u043d\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u0438 \u0440\u0443\u043a\u0430\u043c\u0438. \u0422.\u0435. \u043d\u0430\u0434\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0442\u043e\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044c, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e \u0432 \u0411\u0414. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0435\u0441\u0442\u044c property \u00abv\u00bb<em>(VALUE_PROP)<\/em>. \u0421\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u043c\u043e\u0435 \u0432 \u0431\u0430\u0437\u0435. \u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e. \u0423 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 <em>QRadioButton -\u043e\u0432<\/em> \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 <em>QButtonGroup.<\/em> \u041d\u043e <em>COLUMN_NAME_PROP, TABLE_NAME_PROP<\/em> \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0443 \u043b\u044e\u0431\u043e\u0433\u043e <strong>\u043e\u0434\u043d\u043e\u0433\u043e<\/strong> <em>QRadioButton.<\/em> \u041f\u0440\u043e\u0441\u0442\u043e \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430. \u041a\u043e\u0434 \u0441\u0430\u043c \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0433\u0440\u0443\u043f\u043f\u043e\u0439. <em>VALUE_PROP<\/em> \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0443 \u0432\u0441\u0435\u0445 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u0435\u0439 \u0440\u0430\u0437\u043d\u044b\u0435.<\/p>\n<p>  <\/p>\n<p>\u0412 <em>AddressBookMainWindow<\/em> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d, \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435, \u0441\u0430\u043c\u044b\u0439 \u0441\u043b\u043e\u0436\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0433\u0440\u0443\u043f\u043f\u044b \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u0432\u044b\u0431\u043e\u0440\u0430 \u043f\u043e\u043b\u0430 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u0430. \u0422\u0430\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d \u0444\u0435\u0439\u043a\u043e\u0432\u044b\u0439 <em>QRadioButton,<\/em> \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u043a\u043e\u0433\u0434\u0430 \u0432 \u0411\u0414 \u0445\u0440\u0430\u043d\u0438\u0442\u044c\u0441\u044f NULL.<\/p>\n<p>  <\/p>\n<h2>\u041a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0443 \u0434\u0432\u0443\u043c\u044f \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u0430\u043c\u0438<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/06e\/cc3\/8ec\/06ecc38ec05948c9b17f241518c53479.png\"\/><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u0443\u0441\u0432\u043e\u0435\u043d\u0438\u044f, \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0441\u0430\u043c\u044b\u0439 \u0443\u0436\u0430\u0441\u043d\u044b\u0439 \u0438 \u0437\u0430\u043f\u0443\u0442\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0444\u043e\u0440\u043c\u0435 <em>addressbookmainwindow.ui<\/em> \u0435\u0441\u0442\u044c <em>QComboBox ui-&gt;countryCombo<\/em>. \u0427\u0442\u043e \u0431\u044b \u0435\u0433\u043e \u0432\u0438\u0434\u0435\u0442\u044c \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c <em>ui-&gt;countryCombo-&gt;hide();<\/em> \u0414\u043b\u044f \u0435\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u0431\u0430\u0437\u044b. \u041d\u0430\u0434\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u00abaddress\u00bb. \u041f\u043e\u0442\u043e\u043c \u0435\u0441\u0442\u044c <em>ui-&gt;countryLabel<\/em>. \u0414\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043f\u043e\u043b\u044f \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0442\u0430\u0431\u043b\u0438\u0446\u0435\u0439 \u00abcountry\u00bb.<\/p>\n<p>   \u0414\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cpp\">void AddressBookMainWindow::updateForm() { \t\/\/ \u041d\u0435\u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0440\u043e\u043f\u0443\u0449\u0435\u043d\u043e  \tm_widgetHelpers.fillForm( id ); \tconst QVariant addressId = m_widgetHelpers.getFieldValie( PERSONS_TABLE_NAME, ADDRESS_FK_COL_NAME ); \tsetAddress( addressId ); \tm_widgetHelpers.fillForm( addressId, ADDRESS_TABLE_NAME ); \tconst QVariant countryId( m_widgetHelpers.getFieldValie( ADDRESS_TABLE_NAME, COUNTRY_FK_COL_NAME ) ); \tm_widgetHelpers.fillForm( countryId, COUNTRY_TABLE_NAME ); } <\/code><\/pre>\n<p>  <\/p>\n<ol>\n<li>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0434\u0451\u0442 \u0432\u044b\u0437\u043e\u0432 <em> m_widgetHelpers.setupForm( this, PERSONS_TABLE_NAME );<\/em> \u0432 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0442\u043e\u0440\u0435.<\/li>\n<li>\u041f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430 <em>m_widgetHelpers.fillForm( id );<\/em> \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0443 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00ab\u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e\u00bb (<em><a href=\"#setupForm\">defaultTableName<\/a><\/em> \u0432 <em>setupForm()<\/em>). \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u00abpersons\u00bb<em> (PERSONS_TABLE_NAME).<\/em> \u042d\u0442\u0430 \u0436\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442(\u0438\u043b\u0438 \u0437\u0430\u043c\u0435\u0449\u0430\u0435\u0442) \u043d\u0443\u0436\u043d\u0443\u044e SQL \u0441\u0442\u0440\u043e\u043a\u0443<em>(QSqlRecord)<\/em> \u0432 \u043a\u044d\u0448(<em>m_tablesRecords<\/em>).<\/li>\n<li>\u0414\u0430\u043b\u0435\u0435 <em>m_widgetHelpers.getFieldValie()<\/em> \u0434\u043e\u0441\u0442\u0430\u0451\u0442 \u0438\u0437 \u043a\u044d\u0448\u0430 \u043d\u0443\u0436\u043d\u044b\u0439 \u00ab\u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447\u00bb \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u00abaddress\u00bb<em>(ADDRESS_TABLE_NAME).<\/em> <\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 <em>\u00abaddressId\u00bb<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 <em>setAddress()<\/em>. \u0427\u0442\u043e \u043f\u043e\u043a\u0430 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. <\/li>\n<li>\u041f\u043e\u0442\u043e\u043c \u0432 <em>m_widgetHelpers.fillForm( addressId, ADDRESS_TABLE_NAME );<\/em>. \u0414\u0430\u043d\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0433\u0434\u0435 \u044f\u0432\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 property \u00abt\u00bb \u0440\u0430\u0432\u043d\u044b\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>ADDRESS_TABLE_NAME<\/em> \u0412 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0438 <em>ui-&gt;countryCombo<\/em>. \u042d\u0442\u043e\u0442 \u0436\u0435 \u0432\u044b\u0437\u043e\u0432 \u043f\u043e\u0434\u0433\u0440\u0443\u0436\u0430\u0435\u0442 \u0432 \u043a\u044d\u0448 \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00abaddress\u00bb.<\/li>\n<li> \u0414\u0430\u043b\u0435\u0435 \u0442\u0430\u043a \u0436\u0435 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442\u0441\u044f \u00ab\u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043b\u044e\u0447\u00bb(countryId) \u043d\u0430 \u0437\u0430\u043f\u0438\u0441\u044c \u0432 \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u00abcountry\u00bb. <\/li>\n<li>\u0418 \u0443\u0436\u0435 <em>m_widgetHelpers.fillForm( countryId, COUNTRY_TABLE_NAME )<\/em> \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u0432\u0438\u0434\u0436\u0435\u0442\u044b \u0433\u0434\u0435 property \u00abt\u00bb \u0440\u0430\u0432\u043d\u043e <em>COUNTRY_TABLE_NAME<\/em>(\u00abcountry\u00bb). \u0422.\u0435. <em>ui-&gt;countryLabel<\/em><\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0442\u0443\u0442 \u0432 \u0442\u043e\u043c \u0447\u0442\u043e \u043a\u043e\u043c\u0431\u043e\u0431\u043e\u043a\u0441 \u0441\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u00abforeign key\u00bb. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043c\u0435\u043d\u0438 \u0441\u0442\u043e\u043b\u0431\u0446\u0430 \u0435\u043c\u0443 \u0437\u0430\u0434\u0430\u043d\u043e \u00abcountryid\u00bb<em>(COUNTRY_FK_COL_NAME)<\/em> \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00abaddress\u00bb<em>(ADDRESS_TABLE_NAME).<\/em> \u0422\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0434\u043b\u044f <em>ui-&gt;countryLabel<\/em> \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438\u0437 \u0442\u0430\u0431\u043b\u0438\u0446\u044b \u00abcountry\u00bb \u0432 \u043a\u044d\u0448(\u0447\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0435\u044f\u0432\u043d\u043e). \u0418 \u0443\u0436\u0435 \u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0432\u0438\u0434\u0436\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u0438\u0437 \u043a\u044d\u0448\u0430. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0442\u043e <em>fillForm( countryId, COUNTRY_TABLE_NAME );<\/em> \u043d\u0443\u0436\u0435\u043d \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f <em>ui-&gt;countryLabel<\/em>. \u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0434\u0432\u0430 \u043f\u043e\u043b\u044f \u0432\u044b\u0432\u043e\u0434\u044f\u0449\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0443, \u043f\u043e \u0441\u043e\u0441\u0435\u0434\u0441\u0442\u0432\u0443 \u043d\u0435 \u043d\u0443\u0436\u043d\u044b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0434\u043d\u043e \u0438\u0437 \u043d\u0438\u0445 \u0431\u044b\u043b\u043e \u0441\u043a\u0440\u044b\u0442\u043e.<\/p>\n<p>  <\/p>\n<p><em>ui-&gt;countryLabel<\/em> \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f property \u00abc\u00bb \u0438 \u00abt\u00bb. \u042d\u0442\u0438\u0445 property \u043d\u0435\u0442 \u0443 \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0432 <em>addressbookmainwindow.ui<\/em>. \u041e\u043d\u0438 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e. <\/p>\n<pre><code class=\"cpp\">\tui-&gt;countryLabel-&gt;setProperty( WidgetHelpers::COLUMN_NAME_PROP, COUNTRY_NAME_COLUMN ); \tui-&gt;countryLabel-&gt;setProperty( WidgetHelpers::TABLE_NAME_PROP, COUNTRY_TABLE_NAME ); <\/code><\/pre>\n<p>  \u0421\u043c\u044b\u0441\u043b\u0430 \u0432 \u044d\u0442\u043e\u043c \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u043d\u0435\u0442. \u041f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440 \u0447\u0442\u043e \u0442\u0430\u043a \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c property. \u041c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u0438 \u0441\u0442\u0440\u043e\u043a\u0438 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0445 \u0447\u0435\u0440\u0435\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440 \u0434\u043b\u044f \u0444\u043e\u0440\u043c. \u0422\u0430\u043a\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 property \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043e <em>setupForm()<\/em>.<\/p>\n<p>  <\/p>\n<h2>\u041f\u0440\u043e\u0444\u0438\u0442<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/459\/2e5\/891\/4592e58914334a44a9fa5b5e623ee2fc.png\"\/><\/p>\n<p>\u0421\u0440\u0430\u0437\u0443 \u043f\u043e\u0441\u043b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0441\u0435\u0433\u043e \u044d\u0442\u043e\u0433\u043e. \u0412\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u0441\u0442\u0430\u043b\u0438 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u041e\u0434\u043d\u0430 \u0438\u0437 \u043d\u0438\u0445 \u0432\u044b\u0432\u043e\u0434 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e \u043f\u043e\u043b\u0435 \u0432\u043e \u0432\u0441\u043f\u043b\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0430\u0445 \u043a \u0432\u0438\u0434\u0436\u0435\u0442\u0443. \u041f\u0440\u0438 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043d\u0430 \u0432\u0438\u0434\u0436\u0435\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0447\u0442\u043e \u0442\u043e \u0442\u0438\u043f\u0430 <em>\u00abt = persons, c = skype, id = 3\u00bb<\/em>. \u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u0442\u0430\u0431\u043b\u0438\u0446\u0443, \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0438 \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0441\u0442\u0440\u043e\u043a\u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0431\u044b\u043b\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0434\u0430\u043d\u043d\u043e\u0435 \u043f\u043e\u043b\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u043a\u0438, \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u044b\u0435. \u041d\u0438\u043a\u0443\u0434\u0430 \u043d\u0435 \u0434\u0435\u0432\u0430\u044e\u0442\u0441\u044f. \u0414\u0438\u043d\u0430\u043c\u0438\u0447\u043d\u044b\u0435 \u0442\u043e\u0436\u0435 \u043f\u0440\u0438\u043a\u0440\u0443\u0442\u0438\u0442\u044c \u043d\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430. \u0414\u0443\u043c\u0430\u044e \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u00ab\u043d\u0435\u0440\u0443\u043a\u043e\u0442\u0432\u043e\u0440\u043d\u044b\u0439 \u043f\u0430\u043c\u044f\u0442\u043d\u0438\u043a\u00bb \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0443 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0435\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<h2>QDataMapper<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/690\/e83\/2e3\/690e832e349540a7b6a54d69518ca31d.png\"\/><\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u0442\u0430\u043a\u043e\u0435 \u043c\u043e\u0451 \u0440\u0435\u0448\u0435\u043d\u0438\u0435, \u043a\u0430\u0436\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434\u043d\u044b\u043c \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 <em>QDataMapper.<\/em> \u041f\u0440\u0438\u0437\u043d\u0430\u044e\u0441\u044c \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u043a\u043b\u0430\u0441\u0441. \u041d\u043e \u043e\u043d \u0431\u0430\u043d\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0437\u0430\u0440\u044b\u0442\u044c\u0441\u044f \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 Qt \u0438 \u0432\u044b\u044f\u0441\u043d\u0438\u0442\u044c \u0447\u0442\u043e \u0436\u0435 \u0442\u0430\u043c \u0442\u0430\u043a\u043e\u0435. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u043c\u043e\u0433 \u0431\u044b\u0442\u044c \u043f\u0430\u0442\u0447 \u043a Qt \u043b\u0438\u0431\u043e \u0441\u0432\u043e\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u0430\u043f\u043f\u0435\u0440\u0430. \u0427\u0442\u043e \u043c\u0435\u043d\u044f \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u043b\u043e. \u042f \u0445\u043e\u0442\u0435\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0438\u043c\u0435\u043d\u0430 \u0441\u0442\u043e\u043b\u0431\u0446\u043e\u0432 \u0434\u043b\u044f \u0432\u0438\u0434\u0436\u0435\u0442\u0430 \u0432 QtDesigner. \u042d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u0438 \u043d\u0435 \u0437\u0430\u0445\u043b\u0430\u043c\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0430\u0439\u043b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u043e\u0440\u043c\u044b. QDataMapper \u0436\u0435 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u043e. \u041d\u0430\u0434\u043e \u0440\u0443\u0447\u043a\u0430\u043c\u0438 \u043b\u0438\u043d\u043a\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u043e\u043b\u0431\u0435\u0446 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0432\u0438\u0434\u0436\u0435\u0442. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u044f \u043e\u0431\u044f\u0437\u0430\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043d\u0430\u0434\u0451\u0436\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c <em>QSqlTableModel.<\/em> \u0423 \u043c\u0435\u043d\u044f \u0441 SQLite \u043e\u043d\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e \u0432 Qt \u043d\u0435 \u043e\u0434\u043d\u0430 SQLite. \u041d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a\u0438\u0435 \u0444\u043e\u043a\u0443\u0441\u044b \u044d\u0442\u0438 \u043c\u043e\u0434\u0435\u043b\u0438 \u0431\u0443\u0434\u0443\u0442 \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u0441 \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0431\u0430\u0437\u0430\u043c\u0438. \u0410 \u043c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435. \u041f\u043e\u0442\u043e\u043c, <em>QDataMapper<\/em> \u043d\u0435 \u0437\u0430\u0445\u043e\u0447\u0435\u0442 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0442\u044c <em>QComboBox<\/em> \u0438 <em>QRadioButton<\/em>, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u044e \u044f. <\/p>\n<p>  <\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/863\/95d\/b5f\/86395db5f6534f1296aefe0c509f00a0.png\"\/><\/p>\n<p>\u041d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u0435\u043b\u043e\u0441\u0438\u043f\u0435\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0430\u0447\u043d\u044b\u043c. \u041f\u0438\u0448\u0438\u0442\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u043f\u0438\u043d\u0430\u0439\u0442\u0435 \u043c\u0435\u043d\u044f \u0441\u0438\u043b\u044c\u043d\u043e. \u0412\u0435\u0434\u044c \u044d\u0442\u043e \u043c\u043e\u044f \u043f\u0435\u0440\u0432\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u0437\u0434\u0435\u0441\u044c. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0434\u0430\u043d\u043d\u0430\u044f \u0442\u0435\u043c\u0430. \u0415\u0441\u0442\u044c \u0438\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e \u043c\u043e\u0434\u0435\u043b\u044f\u0445 (\u043a\u043e\u0442\u043e\u0440\u044b\u0435 <em>QAbstractItemModel<\/em>).<\/p>\n<\/p>\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=\"https:\/\/habrahabr.ru\/post\/328670\/\"> https:\/\/habrahabr.ru\/post\/328670\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0443\u0442\u0438\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u0444\u043e\u0440\u043c \u0432\\\u0438\u0437 SQL \u0431\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041a\u043e\u0434 \u0441\u043b\u043e\u0436\u043d\u044b\u0439. \u0414\u043b\u044f \u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043d\u0430\u0434\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0437\u043d\u0430\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a Qt \u043f\u043e \u0447\u0430\u0441\u0442\u0438 QtGui, QtSql. \u0418 \u0445\u043e\u0442\u044f \u0431\u044b \u0441\u0440\u0435\u0434\u043d\u0435 C++.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/web\/b5d\/699\/3af\/b5d6993afba84fbd9f333bdf4fdfa347.png\"\/>  <\/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-286340","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/286340","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=286340"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/286340\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=286340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=286340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=286340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}