PageSourceSearch

https://wiki.luckfox.com/assets/js/17381079.65fa4350.js

js luckfox.com collected 2026-10-03 19:12:51 UTC 18,174 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkdoc_test=self.webpackChunkdoc_test||[]).push([["1950"],{80177(e,n,i){i.r(n),i.d(n,{metadata:()=>t,default:()=>x,frontMatter:()=>o,contentTitle:()=>c,toc:()=>h,assets:()=>a});var t=JSON.parse('{"id":"Luckfox Lyra/GUI/QT","title":"QT Environment Setup","description":"Luckfox Lyra RK3506","source":"@site/docs/Luckfox Lyra/GUI/QT.md","sourceDirName":"Luckfox Lyra/GUI","slug":"/Luckfox-Lyra/GUI/QT","permalink":"/Luckfox-Lyra/GUI/QT","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":1,"frontMatter":{"description":"Luckfox Lyra RK3506","title":"QT Environment Setup","slug":"/Luckfox-Lyra/GUI/QT","sidebar_position":1},"sidebar":"lyraSidebar","previous":{"title":"RT-Thread Development","permalink":"/Luckfox-Lyra/RT-Thread"},"next":{"title":"FAQ","permalink":"/Luckfox-Lyra/FAQ"}}'),s=i(74848),r=i(28453);function l(e){let n={a:"a",code:"code",h2:"h2",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.h2,{id:"1-introduction-to-qt",children:"1. Introduction to Qt"}),"\n",(0,s.jsx)(n.p,{children:"Qt is a powerful cross-platform application and user interface development framework, originally developed by Trolltech, a Norwegian company, and now maintained by Qt Company. On December 8, 2020, the company released Qt 6, the latest version. Qt is written in C++ and supports various programming languages through language bindings, making it an ideal choice for building high-quality, cross-platform applications."}),"\n",(0,s.jsx)(n.p,{children:"As a one-stop development solution, Qt is not limited to graphical user interface (GUI) development. It also supports modules for command-line tools, network communication, multithreading, audio-video processing, file operations, and more. Qt is widely used for desktop, embedded, and mobile application development. In real-world applications, its flexibility and efficiency are well-proven. For example, the main interface of the Linux version of WeChat is developed using Qt, while the web rendering component is implemented with GTK, demonstrating Qt's ability to integrate with other technology stacks."}),"\n",(0,s.jsx)(n.p,{children:"Qt is applied across a broad range of fields, from desktop software (e.g., VirtualBox, Battle.net client) to embedded devices (e.g., consumer electronics, industrial controls), and even modern cross-platform development needs. Its modular design and excellent cross-platform support make it a top choice for developers creating high-quality applications, cementing its core position in both open-source and commercial development."}),"\n",(0,s.jsx)(n.h2,{id:"2-why-c",children:"2. Why C++?"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsx)(n.li,{children:"C++ is a compiled language that offers superior runtime performance, making it suitable for scenarios requiring high performance and low latency, such as embedded devices, backend logic processing, and complex algorithm computation."}),"\n",(0,s.jsx)(n.li,{children:"For complex logic involving system calls, large-scale multithreading, or network communication, C++ provides powerful language features and flexible control."}),"\n",(0,s.jsx)(n.li,{children:"If a project requires reusing existing C++ libraries or interacting with low-level hardware, using C++ directly reduces the need for additional adaptation work."}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"In practice, many projects use both\u2014QML for frontend interface development and C++ for implementing core logic and performance-critical components. The introduction of QML in Qt 5 is an additional option, not a mandatory choice."}),"\n",(0,s.jsx)(n.h2,{id:"3-qt-versions",children:"3. Qt Versions"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Commercial Edition:"}),"\n",(0,s.jsx)(n.p,{children:"The commercial edition requires a paid license and is suitable for companies and developers who want to develop proprietary software without sharing the source code."}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Open Source Edition:"}),"\n",(0,s.jsx)(n.p,{children:"The open-source edition is released under the GNU Lesser General Public License (LGPL) and the GNU General Public License (GPL). Users can use Qt for free but must comply with the terms of these licenses"}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Historical Versions:"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Version"}),(0,s.jsx)(n.th,{children:"Release Year"}),(0,s.jsx)(n.th,{children:"Key Features"})]})}),(0,s.jsxs)(n.tbody,{children:[(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Qt 1.x"}),(0,s.jsx)(n.td,{children:"1996"}),(0,s.jsx)(n.td,{children:"Initial release focused on the X11 platform"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Qt 2.x"}),(0,s.jsx)(n.td,{children:"1999"}
1),(0,s.jsx)(n.td,{children:"Added support for Microsoft Windows"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Qt 3.x"}),(0,s.jsx)(n.td,{children:"2001"}),(0,s.jsx)(n.td,{children:"Introduced new features, including network and XML support"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Qt 4.x"}),(0,s.jsx)(n.td,{children:"2005"}),(0,s.jsx)(n.td,{children:"Major improvements enhancing cross-platform support and the graphics view framework"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Qt 5.x"}),(0,s.jsx)(n.td,{children:"2012"}),(0,s.jsx)(n.td,{children:"Focused on modern hardware performance, introduced QML and Qt Quick for fluid animations and touch interfaces"})]}),(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Qt 6.x"}),(0,s.jsx)(n.td,{children:"2020"}),(0,s.jsx)(n.td,{children:"Enhanced performance and functionality, optimized for future software development trends, including 3D graphics support"})]})]})]}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"This tutorial will guide you in setting up a Qt 5 environment in a Buildroot system. Although Qt 6 offers significant updates and improvements, such as better support for modern C++ standards and optimized graphics engines, Qt 5 still has advantages like broader compatibility, mature stability, extensive third-party library support, comprehensive documentation, and an active community."}),"\n",(0,s.jsx)(n.h2,{id:"4-installing-qt-pc-ubuntu-2204-environment",children:"4. Installing Qt (PC Ubuntu 22.04 Environment)"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Download the Qt installer:"}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Official website:",(0,s.jsx)(n.a,{href:"https://download.qt.io/archive/qt/5.12/5.12.9/",children:"https://download.qt.io/archive/qt/5.12/5.12.9/"})]}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(78952).A+"",width:"926",height:"517"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Alternative sources if the official site is inaccessible:"}),"\n",(0,s.jsxs)(n.table,{children:[(0,s.jsx)(n.thead,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.th,{children:"Source"}),(0,s.jsx)(n.th,{children:"Link"})]})}),(0,s.jsx)(n.tbody,{children:(0,s.jsxs)(n.tr,{children:[(0,s.jsx)(n.td,{children:"Google"}),(0,s.jsx)(n.td,{children:(0,s.jsx)(n.a,{href:"https://drive.google.com/drive/folders/1ycihPEtzDTh_rEFOhBa2HAxp5zxQ7NXX?usp=drive_link",children:"Download"})})]})})]}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Register on the Qt official website using your email address:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"https://login.qt.io/login\n"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Transfer the installer to the Ubuntu system",":If"," you want to skip login during installation, disconnect from the internet."]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"chmod +x qt-opensource-linux-x64-5.12.9\n./qt-opensource-linux-x64-5.12.9\n"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Installation Process:"}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(9471).A+"",width:"498",height:"555"})})}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(20830).A+"",width:"498",height:"555"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Follow the steps shown in the installer interface."}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(48760).A+"",width:"492",height:"712"})})}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"5-adding-qt-5-to-buildroot",children:"5. Adding Qt 5 to Buildroot"}),"\n",(0,s.jsx)(n.p,{children:'Refer to the "SDK Environment Deployment" section for detailed steps on configuring Buildroot to include Qt 5.'}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["Add QT5 in buildroot.","\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(55454).A+"",width:"1098",height:"306"})})}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(52607).A+"",width:"1119",height:"608"})})}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(51068).A+"",width:"1089",he
1ight:"606"})})}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"6-configuring-qmake",children:"6. Configuring qmake"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Create ",(0,s.jsx)(n.code,{children:"qt.conf"})," in the qmake directory:"]}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"cd /SDK\u76EE\u5F55/buildroot/output/rockchip_rk3506_luckfox/build/qt5base-da6e958319e95fe564d3b30c931492dd666bfaff/qmake\ncp ~/Qt5.12.9/5.12.9/gcc_64/bin/qt.conf .\n\nvim qt.conf\n# Add the following lines:\n[Paths]\nPrefix=..\n"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Update the qmake symbolic link path:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"sudo apt install qtchooser -y\nluckfox@luckfox:~$ which qmake\nusr/bin/qmake\n\n sudo rm /usr/bin/qmake\n"})}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.p,{children:"sudo ln -s /SDK\u76EE\u5F55/buildroot/output/rockchip_rk3506_luckfox/build/qt5base-da6e958319e95fe564d3b30c931492dd666bfaff/qmake/qmake /usr/bin/qmake"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{children:"\n3. Update environment variables:\n\n```bash\nvim ~/.bashrc\n\nexport PATH=/home/ubuntu/Luckfox/rk3506/luckfox-lyra-sdk/buildroot/output/rockchip_rk3506_luckfox/host/arm-buildroot-linux-gnueabihf/lib:$PATH\n\nsource ~/.bashrc\n"})}),"\n",(0,s.jsxs)(n.ol,{start:"4",children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Check qmake version:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"(base) luckfox@luckfox:~$ qmake -v\nQMake version 3.1\nUsing Qt version 5.15.11 in /home/ubuntu/Luckfox/rk3506/luckfox-lyra-sdk/buildroot/output/rockchip_rk3506_luckfox/host/arm-buildroot-linux-gnueabihf/sysroot/home/usr/lib\n"})}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"7-configuring-cross-compiler",children:"7. Configuring Cross-Compiler"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Open Qt Creator and navigate to ",(0,s.jsx)(n.strong,{children:"Tools > Options > Compilers"}),"."]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Add the GCC and G++ compilers with appropriate paths."}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(5463).A+"",width:"1452",height:"866"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Add 3506 G++ Name and Compiler Path"}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(89813).A+"",width:"1452",height:"866"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Configure Qt Versions"}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(57565).A+"",width:"1788",height:"1090"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Configure Kits"}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(21461).A+"",width:"1787",height:"1088"})})}),"\n"]}),"\n"]}),"\n",(0,s.jsx)(n.h2,{id:"8-create-your-first-project",children:"8. Create Your First Project"}),"\n",(0,s.jsxs)(n.ol,{children:["\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Create a new Qt project."}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(28687).A+"",width:"382",height:"508"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Name the project and select the storage path."}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(21607).A+"",width:"876",height:"555"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsxs)(n.p,{children:["Choose ",(0,s.jsx)(n.strong,{children:"qmake"}),"."]}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(65108).A+"",width:"800",height:"536"})})}),"\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(85113).A
1+"",width:"791",height:"524"})})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"After completing your Qt project, navigate to the project directory for cross-compilation."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"qmake && make\n"})}),"\n",(0,s.jsxs)(n.ul,{children:["\n",(0,s.jsxs)(n.li,{children:["Upon successful compilation, an executable file will be generated:","\n",(0,s.jsx)("div",{style:{maxWidth:1e3},children:(0,s.jsx)(n.p,{children:(0,s.jsx)(n.img,{src:i(72073).A+"",width:"1101",height:"75"})})}),"\n"]}),"\n"]}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Upload the executable file from the Ubuntu host (or virtual machine) to the development board:"}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"scp test-1 [email protected]:/root\n"})}),"\n"]}),"\n",(0,s.jsxs)(n.li,{children:["\n",(0,s.jsx)(n.p,{children:"Run the program on the development board."}),"\n",(0,s.jsx)(n.pre,{children:(0,s.jsx)(n.code,{className:"language-bash",children:"chmod +x test\n./test -platform linuxfb\n"})}),"\n"]}),"\n"]})]})}function d(e={}){let{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(l,{...e})}):l(e)}let o={description:"Luckfox Lyra RK3506",title:"QT Environment Setup",slug:"/Luckfox-Lyra/GUI/QT",sidebar_position:1},c,a={},h=[{value:"1. Introduction to Qt",id:"1-introduction-to-qt",level:2},{value:"2. Why C++?",id:"2-why-c",level:2},{value:"3. Qt Versions",id:"3-qt-versions",level:2},{value:"4. Installing Qt (PC Ubuntu 22.04 Environment)",id:"4-installing-qt-pc-ubuntu-2204-environment",level:2},{value:"5. Adding Qt 5 to Buildroot",id:"5-adding-qt-5-to-buildroot",level:2},{value:"6. Configuring qmake",id:"6-configuring-qmake",level:2},{value:"7. Configuring Cross-Compiler",id:"7-configuring-cross-compiler",level:2},{value:"8. Create Your First Project",id:"8-create-your-first-project",level:2}];function p(e){return(0,s.jsx)(d,{})}function x(e={}){let{wrapper:n}={...(0,r.R)(),...e.components};return n?(0,s.jsx)(n,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},89813(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/3506-Compilers-g-328157e63d0b74e205524eed819396f2.webp"},5463(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/3506-Compilers-gcc-8a6362d236e4154793e3d18ce7a2f37c.webp"},21461(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/3506-qtkits-2bcc32e1b8317d838171ebfe59b29adc.webp"},57565(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/3506-qtversions-d29e838bb08cc2ecc691fe67be262537.webp"},55454(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt-buildroot-1-ab361c244e19e0862d43d9e85578cd12.webp"},52607(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt-buildroot-2-5747ce93d30c90eb942b0a7a9da66e0a.webp"},51068(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt-buildroot-3-4c39d8e14d616391b66db4e67d464f77.webp"},78952(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt-download-fccb587bbde6dbd3c9029c4600115c9c.webp"},48760(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt-installer-73457c6ef90c336ef8bad910ce616e54.gif"},21607(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt5-Application-b6b895f2a2d86fd0b02be4f498bd2475.webp"},85113(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt5-first-project-a7b8a3702d2f07e56f65961b43d2e7bd.gif"},9471(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt5-installer-1-a5df22f8642debaa03742795b3f6fdfc.webp"},20830(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt5-installer-2-67f6bcd6b2e32c2b801097a301f93326.webp"},28687(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt5-new-project-60936fcb87a84c29482f92e7d9d5e9ea.webp"},65108(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt5-project-location-4de8b05a663d67bb099528ea3b67b81e.webp"},72073(e,n,i){i.d(n,{A:()=>t});let t=i.p+"assets/images/Qt5-qmake-make-99c068a51a8de44c22a4c8c54b384a46.webp"},28453(e,n,i){i.d(n,{R:()=>l,x:()=>d});var t=i(96540);let s={},r=t.createContext(s);function l(e){let n=t.useContext(r);return t.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.