1. The first thing we need to do is open up Qt Creator and create a new project. If this is
the first time you have used Qt Creator, you can either click the big button that says
New Project with a + sign, or simply go to File | New File or New Project.
2. Then, select Application under the Project window and select Qt Widgets Application.
3. After that, click the Choose button at the bottom. A window will then pop out and
ask you to insert the project name and its location.
4. Once you‘re done with that, click Next several times and click the Finish button
to create the project. We will just stick to all the default settings for now. Once the
project has been created, the first thing you will see is the panel with tons of big icons
on the left side of the window that is called the Mode Selector panel; we will discuss
this more later in the How it works.。. section.
5. Then, you will also see all your source files listed on the Side Bar panel which is
located right next to the Mode Selector panel. This is where you can select which file
you want to edit, which, in this case, is mainwindow.ui because we are about to
start designing the program’s UI!
6. Double-click mainwindow.ui and you will see an entirely different interface
appearing out of nowhere. Qt Creator actually helped you to switch from the script
editor to the UI editor (Qt Designer) because it detected the .ui extension on the file
you‘re trying to open.
7. You will also notice that the highlighted button on the Mode Selector panel has
changed from the Edit button to the Design button. You can switch back to the script
editor or change to any other tools by clicking one of the buttons located in the upper
half of the Mode Selector panel.
8. Let’s go back to the Qt Designer and look at the mainwindow.ui file. This is basically
the main window of our program (as the filename implies) and it‘s empty by default,
without any widget on it. You can try to compile and run the program by pressing the
Run button (green arrow button) at the bottom of the Mode Selector panel, and you
will see an empty window popping up once the compilation is complet
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉
全部0条评论
快来发表一下你的评论吧 !