QT5杂谈之初体验

来源:互联网 发布:网络约租车管理办法 编辑:程序博客网 时间:2024/05/16 07:32

      地点:宿舍

      环境:XP+QT5.0.2 MinGW

      安装完成后需要设置两个环境变量

          键:QTDIR

          值:C:\Qt\Qt5.0.2\5.0.2\mingw47_32

         在Path变量后加入:I:\Qt\Qt5.0.2\5.0.2\mingw47_32\bin

        注意xp和win7中的PATH用; 分割

  

      QT5中主推的一个特性就是QML,这确实是个好东西,可以将表现层和业务逻辑层很好的分离了。而我发现在搜索了很多QT学习相关后,最终回到的还是Assistent帮助文档,这个最靠谱,也最权威。

      而学习的方式就是在Qt助手的索引中输入QT,点击QT5.0,这时会发现:

Getting Started

  • Getting Started with Qt
  • What's New in Qt 5
  • Examples and Tutorials
  • Supported Platforms
  • Qt Licensing

           这是好东西啊。这些内容直接指引了我们学习的初期阶段步骤,从最基本的开始,从最简单的开始。

    选择第一项就会看到:

    The Tutorials

    There are two separate tutorials for creating two similar applications. One implements the user interface using Qt Quick, while the other uses Qt Widgets.

    Please click on one of the links below to start the ride.

         当然还有其他的东西,感兴趣可以自己看下。先看看Qt Quick。但是这个不是我推荐的学习路线(因为内容稍显复杂),我们再进Examples

    and tutorials,这个比较具体了。

         但是Qt Creator下的那个连接都不能用了,不知道什么情况。但是剩余的已经足够初期学一段时间了。看到那些小标题后面的Essentials了吧,这些都是必要的,怎么能不看?

         先看看Qt Quick Essentials。

    hello World中有qml的运行方式:

    qmlscene tutorials/helloworld/tutorial1.qml

    QML Text Editor 就和Getting Started with Qt中的一样了。似乎QT中的工作人员先小show了一把。但是

    examples/tutorials/gettingStartedQml/filedialog根本没这个路径啊。直接搜索后发现在:

    \Qt\Qt5.0.2\5.0.2\mingw47_32\examples\quick\tutorials\gettingStartedQml\core,但是直接用qmlscene是运行不了的。

    建议自己建一个目录做一下实验。