42 #include <QtGui> |
42 #include <QtGui> |
43 #include <QDeclarativeEngine> |
43 #include <QDeclarativeEngine> |
44 #include <QDeclarativeComponent> |
44 #include <QDeclarativeComponent> |
45 #include <QDebug> |
45 #include <QDebug> |
46 #include <QDeclarativeView> |
46 #include <QDeclarativeView> |
47 #include <QContactManager> |
47 #include <qcontactmanager.h> |
48 #include "qmlcontactsa.h" |
48 #include "qmlcontactmodel.h" |
49 #include "qmlcontact.h" |
49 |
50 QT_USE_NAMESPACE |
50 QT_USE_NAMESPACE |
51 QTM_USE_NAMESPACE |
51 QTM_USE_NAMESPACE |
52 |
52 |
53 int main(int argc, char ** argv) |
53 int main(int argc, char ** argv) |
54 { |
54 { |
55 QApplication app(argc, argv); |
55 QApplication app(argc, argv); |
56 |
56 |
57 |
57 |
58 QDeclarativeEngine engine; |
58 QDeclarativeEngine engine; |
59 QDeclarativeComponent component(&engine, ":example.qml"); |
|
60 |
59 |
61 qmlRegisterType<QmlContact>("QmlContact", 1, 0, "QmlContact"); |
60 qmlRegisterType<QMLContactModel>("QmlContactModel", 1, 0, "QmlContactModel"); |
62 qmlRegisterType<QMLContactManagerAsync>("QMLContactManagerAsync", 1, 0, "QMLContactManagerAsync"); |
|
63 |
61 |
64 QWidget *b = new QWidget(); |
62 QWidget *b = new QWidget(); |
65 QVBoxLayout *vbox = new QVBoxLayout; |
63 QVBoxLayout *vbox = new QVBoxLayout; |
66 vbox->setMargin(0); |
64 vbox->setMargin(0); |
67 |
65 |
69 view->setFocusPolicy(Qt::StrongFocus); |
67 view->setFocusPolicy(Qt::StrongFocus); |
70 view->setResizeMode(QDeclarativeView::SizeViewToRootObject); |
68 view->setResizeMode(QDeclarativeView::SizeViewToRootObject); |
71 view->setSource(QUrl("qrc:/example.qml")); |
69 view->setSource(QUrl("qrc:/example.qml")); |
72 vbox->addWidget(view); |
70 vbox->addWidget(view); |
73 b->setLayout(vbox); |
71 b->setLayout(vbox); |
74 // b->resize(800,480); |
|
75 b->show(); |
72 b->show(); |
76 |
73 |
77 return app.exec(); |
74 return app.exec(); |
78 } |
75 } |