{"id":802,"date":"2015-09-20T20:36:39","date_gmt":"2015-09-21T03:36:39","guid":{"rendered":"http:\/\/visualgdb.com\/w\/?p=802"},"modified":"2017-09-18T21:19:23","modified_gmt":"2017-09-19T04:19:23","slug":"creating-a-qt-embedded-app-for-raspberry-pi","status":"publish","type":"post","link":"https:\/\/visualgdb.com\/tutorials\/raspberry\/qt\/embedded\/app\/","title":{"rendered":"Creating a Qt-Embedded app for Raspberry Pi"},"content":{"rendered":"<p>This tutorial shows how to build and debug a Qt 5 app For Raspberry Pi using a cross-compiled Qt build. Before you begin, follow <a href=\"https:\/\/visualgdb.com\/tutorials\/raspberry\/qt\/embedded\">this tutorial<\/a> to create a cross-compiled build of the Qt framework.<\/p>\n<ol>\n<li>Start Visual Studio. Select File-&gt;New-&gt;Project and choose the VisualGDB Linux project wizard:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/00-qted.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-812\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/00-qted.png\" alt=\"00-qted\" width=\"800\" height=\"466\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/00-qted.png 800w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/00-qted-300x175.png 300w\" sizes=\"(max-width: 800px) 100vw, 800px\" \/><\/a><\/li>\n<li>Select Create a new project -&gt; Applications -&gt; Use Qt:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-prj.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-804\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-prj.png\" alt=\"01-prj\" width=\"696\" height=\"628\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-prj.png 696w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/01-prj-300x271.png 300w\" sizes=\"(max-width: 696px) 100vw, 696px\" \/><\/a><\/li>\n<li>On the next page select &#8220;Build the project locally&#8221; and specify your Raspberry Pi cross-toolchain and the connection settings:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-comp.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-805\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-comp.png\" alt=\"02-comp\" width=\"696\" height=\"628\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-comp.png 696w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/02-comp-300x271.png 300w\" sizes=\"(max-width: 696px) 100vw, 696px\" \/><\/a><\/li>\n<li>Click the link at the bottom of the page to configure the Qt settings:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/03-configure.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-806\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/03-configure.png\" alt=\"03-configure\" width=\"696\" height=\"628\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/03-configure.png 696w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/03-configure-300x271.png 300w\" sizes=\"(max-width: 696px) 100vw, 696px\" \/><\/a><\/li>\n<li>Select &#8220;Use previously configured Qt tools&#8221; and specify the path to the <strong>qmake<\/strong> binary and the specs directory used when building the Qt framework as described in <a href=\"http:\/\/visualgdb.com\/tutorials\/raspberry\/qt\/embedded\/\">this tutorial<\/a>:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-dirs.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-807\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-dirs.png\" alt=\"04-dirs\" width=\"712\" height=\"354\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-dirs.png 712w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/04-dirs-300x149.png 300w\" sizes=\"(max-width: 712px) 100vw, 712px\" \/><\/a><\/li>\n<li>Press &#8220;Finish&#8221; to create your project. Then build it with Ctrl-Shift-B:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-build.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-808\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-build.png\" alt=\"05-build\" width=\"699\" height=\"607\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-build.png 699w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/05-build-300x261.png 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/a><\/li>\n<li>Press F5 to start debugging and look at the screen connected to the HDMI port on your Raspberry Pi. If you are using the Embedded Qt build (non-X11), the simple main window used in the example will be automatically stretched to the entire screen:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-button.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-809\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-button.png\" alt=\"06-button\" width=\"700\" height=\"438\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-button.png 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/06-button-300x188.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>Set a breakpoint in the ButtonClicked() method and click the button on the Raspberry Pi screen. The breakpoint will get triggered:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-msgbox.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-810\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/07-bkpt.png\" alt=\"07-bkpt\" width=\"699\" height=\"606\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/07-bkpt.png 699w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/07-bkpt-300x260.png 300w\" sizes=\"(max-width: 699px) 100vw, 699px\" \/><\/a><\/li>\n<li>Resume your program by pressing F5 and observe the &#8220;Hello, world&#8221; message. If you are using the Qt-embedded build that does not use X11 and has no window manager, the message box will have no frame around it:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-msgbox.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-811\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-msgbox.png\" alt=\"08-msgbox\" width=\"700\" height=\"438\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-msgbox.png 700w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/08-msgbox-300x188.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><\/a><\/li>\n<li>You can edit various settings of your project by right-clicking on it in Solution Explorer and selecting &#8220;VisualGDB Project Properties&#8221;:<a href=\"http:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/09-props.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-813\" src=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/09-props.png\" alt=\"09-props\" width=\"868\" height=\"742\" srcset=\"https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/09-props.png 868w, https:\/\/visualgdb.com\/w\/wp-content\/uploads\/2015\/09\/09-props-300x256.png 300w\" sizes=\"(max-width: 868px) 100vw, 868px\" \/><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>This tutorial shows how to build and debug a Qt 5 app For Raspberry Pi using a cross-compiled Qt build.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[72,33,46,43],"_links":{"self":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/802"}],"collection":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/comments?post=802"}],"version-history":[{"count":3,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/802\/revisions"}],"predecessor-version":[{"id":3232,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/posts\/802\/revisions\/3232"}],"wp:attachment":[{"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/media?parent=802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/categories?post=802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/visualgdb.com\/w\/wp-json\/wp\/v2\/tags?post=802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}