Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1039985
  • 博文数量: 264
  • 博客积分: 6005
  • 博客等级: 大校
  • 技术积分: 2798
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-08 20:15
文章分类

全部博文(264)

文章存档

2011年(42)

2010年(213)

2009年(4)

2008年(2)

2007年(3)

分类: C/C++

2010-10-16 10:20:17

=================================================
// c++
=================================================
#include
#include 
#include 
#include 
#include 
#include 


int main(int argc, char *argv[]) { QApplication app(argc, argv); QDeclarativeView view; view.setSource(QUrl::fromLocalFile("main.qml")); view.show(); QDeclarativeItem *item = view.rootObject()->findChild<QDeclarativeItem*>("myRect"); if (item) { item->setProperty("color", QColor(Qt::yellow)); } return app.exec(); }

====================================
// qml 界面显示   main.qml
===================================
import Qt 4.7 Item { width: 200; height: 200 Rectangle { anchors.fill: parent color: "red" objectName: "myRect" } }




阅读(5205) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-10-19 08:51:26

很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com