qml(Qt Quick)做界面

来源  https://www.zhihu.com/question/24880681/answer/29324824

本人是Qt初学者,正在写一个会计小软件(Linux桌面版)。看了Qt的介绍,觉得用qml(Qt Quick)做界面非常机动快速,但是qml(Qt Quick)处理复杂的业务逻辑就有点力不从心了。
不知道能否用qml(Qt Quick)做界面,用C++(Qt)实现业务逻辑?如果可以,大概的思路是怎么样?
 

-----------------------------

题主你好,你说的这种思路是目前Digia主推的一种思路。(今年去参加Qt开发者大会的时候,几乎一半的讲座都会推荐这种用法。)

所以,如何结合QML和C++,官网上会有很多的例子和教程,希望你仔细看看。(另外,鉴于4.8时代的Qt Quick的问题(bug)还不少,所以建议使用最新版的Qt5.3+来做这样的试验。)

这是我随手找到的:Introduction_to_Qt_Quick_for_Cpp_developers
Writing QML Extensions with C++

一个更详尽的例子:
Qt Quick 之 QML 与 C++ 混合编程详解

还有这个制作五子棋小游戏的教程,非常有意思。:http://quitcoding.com/download/Qt_Quick_Game_Programming_1_0.pdf
用的Qt Quick版本较老,但思路可以借鉴。

不谢。

编辑于 2014-08-18

-----------------------------

关于QML和C++的集成,参考文档:http://doc.qt.io/qt-5/qtqml-cppintegration-topic.html

QtQuickControls以及QtQuickControls2的最新进展,

QtCS2015 QtQuickControls2
Background
QtQuick.Controls 1 has tons and tons of objects per control
Overview
QtQuick.Controls 2 has interaction logic in C++, greatly decreases object overhead and number of contexts
QtQuick.Controls 2 has visual items still in a (thin) QML layer
Styling, theming and customization
Native/platform styles currently out of scope
Would be in a separate (derived) imports?
Currently QtQuick.Controls 2 has a simple themable QML layer
Ongoing work adapting the palette concept from widgets (QTBUG-45839)
Parts of controls can be replaced with custom delegates
Status
Popup items vs. popup windows
Text selection handles via IM
No scaling (logical units?) thought of yet
Discussion
Accessibility in the QML layer? Needed as it's private from QtQuick
Some embedded users don't want accessibility. Seems "Short-sighted".
Continue with controls 1 until native/desktop gets brought into the controls 2 idea
As in done and maintained, but R&D on controls 2

大家可以参考:

=============== End

最新文章

  1. Using Recursive Common table expressions to represent Tree structures
  2. [翻译]opengl扩展教程1
  3. 通过 Informix 系统表监控和优化数据库
  4. L1 - 闭包和原型链
  5. C#使用FtpWebRequest上传文件
  6. 创业草堂之一:创业的Idea是怎样产生的?
  7. Kerberos认证流程详解
  8. sql server 2005 外围应用配置器
  9. JAVA学习篇--JSTL基金会
  10. Eclipse Maven构建Spring MVC项目
  11. (二)—Linux远程连接与常用命令
  12. Hadoop问题:Incorrect configuration: namenode address dfs.namenode.rpc-address is not configured
  13. CDQ 分治算法模板
  14. JNDI是什么
  15. 云主机中毒 cpu爆满解决日志
  16. Marriage Match IV HDU - 3416(最短路 + 最大流)
  17. delphi 导出到excel的7种方法
  18. linux 编译链接问题
  19. Android-Binder机制
  20. Promise 初步

热门文章

  1. Mysql多实例之mysql服务脚本
  2. 软件工程(FZU2015) 学生博客列表(最终版)
  3. 使用Request+正则抓取猫眼电影(常见问题)
  4. Django之admin中管理models中的表格
  5. jdk下载及环境变量配置
  6. React-Native之轮播组件looped-carousel的介绍与使用
  7. 字符串和ASCII之间的转换
  8. PhpStorm 头部注释、类注释和函数注释的设置
  9. vue的地图插件amap
  10. CentOS7 网络NAT模式