分类: C/C++
2010-10-16 10:20:17
#include
#include
#include
#include
#includeint 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" } }
chinaunix网友2010-10-19 08:51:26
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com