diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/platforms/uikit/examples/qmltest/main.mm | 16 | ||||
-rw-r--r-- | src/plugins/platforms/uikit/quikitwindowsurface.h | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/plugins/platforms/uikit/examples/qmltest/main.mm b/src/plugins/platforms/uikit/examples/qmltest/main.mm index 2b5f024..ea4e90c 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/main.mm +++ b/src/plugins/platforms/uikit/examples/qmltest/main.mm @@ -45,9 +45,22 @@ #include <QtGui/QApplication> #include <QtCore/QtPlugin> +#include <QtDeclarative/QDeclarativeEngine> Q_IMPORT_PLUGIN(UIKit) +static QString qStringFromNSString(NSString *nsstring) +{ + return QString::fromUtf8([nsstring UTF8String]); +} + +static QString documentsDirectory() +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *documentsDirectory = [paths objectAtIndex:0]; + return qStringFromNSString(documentsDirectory); +} + int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; @@ -55,8 +68,9 @@ int main(int argc, char *argv[]) { QApplication app(argc, argv); QmlApplicationViewer viewer; viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + viewer.engine()->setOfflineStoragePath(documentsDirectory()); NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; - viewer.setMainQmlFile(QString::fromUtf8([[resourcePath stringByAppendingPathComponent:@"qml/main.qml"] UTF8String])); + viewer.setMainQmlFile(qStringFromNSString([resourcePath stringByAppendingPathComponent:@"qml/main.qml"])); viewer.showMaximized(); int retVal = app.exec(); [pool release]; diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.h b/src/plugins/platforms/uikit/quikitwindowsurface.h index 50d02b4..81f60f5 100644 --- a/src/plugins/platforms/uikit/quikitwindowsurface.h +++ b/src/plugins/platforms/uikit/quikitwindowsurface.h @@ -72,7 +72,7 @@ public: void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); void resize (const QSize &size); - QImageView *nativeView() const { return mView; } + UIView *nativeView() const { return mView; } private: QImage *mImage; QImageView *mView; |