4.下面我们打开安装好的Qt Creator,可以看到,新的Qt Creator的界面有所变化。
5.我们先新建常用的Gui工程Qt Gui Application,工程名设为“hello”,然后设置下面的保存路径,注意路径中不能有中文。后面的选项全部默认即可。
6.建立好工程后,我们双击mainwindow.ui文件,这时便进入了界面设置模式,我们在窗口上添加一个Label部件,然后更改其内容为“hello world!”效果如下。
可以看到,新的Qt Creator中添加了一个界面设计模式的选项 ,我们可以更方便的从代码编辑界面转到可视的窗口设计界面。这时我们再回到Edit界面中,可以看到ui文件的内容,它是一个XML文件。
7 这时我们点击Run按钮,运行程序,如果这时出现下面的提示框,我们选中其中的选择框,然后点击“Save All”按钮即可。
8. note
Setting Up a qmake Project for Windows
To add a Qt version for MinGW:
Select Tools > Options... > Qt4 > Qt Versions.
Click and enter the name of the version in Version Name field.
Enter the qmake binary path in the qmake Location.
Enter the MinGW installation path in the MinGW Directory.