Qt 4.8
Functions
main.mm File Reference
#import <UIKit/UIKit.h>
#include "../share/qmlapplicationviewer/qmlapplicationviewer.h"
#include <QtGui/QApplication>
#include <QtCore/QtPlugin>
#include <QtDeclarative/QDeclarativeEngine>

Go to the source code of this file.

Functions

static QString documentsDirectory ()
 
int main (int argc, char *argv[])
 
static QString qStringFromNSString (NSString *nsstring)
 

Function Documentation

◆ documentsDirectory()

static QString documentsDirectory ( )
static

Definition at line 57 of file main.mm.

Referenced by main().

58 {
59  NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
60  NSString *documentsDirectory = [paths objectAtIndex:0];
61  return qStringFromNSString(documentsDirectory);
62 }
static QString qStringFromNSString(NSString *nsstring)
Definition: main.mm:52
static QString documentsDirectory()
Definition: main.mm:57

◆ main()

int main ( int  argc,
char *  argv[] 
)

Definition at line 64 of file main.mm.

64  {
65 
66  NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
67 
68  QApplication app(argc, argv);
69  QmlApplicationViewer viewer;
72  NSString *resourcePath = [[NSBundle mainBundle] resourcePath];
73  viewer.setMainQmlFile(qStringFromNSString([resourcePath stringByAppendingPathComponent:@"qml/main.qml"]));
74  viewer.showMaximized();
75  int retVal = app.exec();
76  [pool release];
77  return retVal;
78 }
void showMaximized()
Shows the widget maximized.
Definition: qwidget.cpp:3218
The QApplication class manages the GUI application&#39;s control flow and main settings.
Definition: qapplication.h:99
void setOfflineStoragePath(const QString &dir)
void setOrientation(ScreenOrientation orientation)
static bool init
void setMainQmlFile(const QString &file)
QDeclarativeEngine * engine() const
Returns a pointer to the QDeclarativeEngine used for instantiating QML Components.
static QString qStringFromNSString(NSString *nsstring)
Definition: main.mm:52
static QString documentsDirectory()
Definition: main.mm:57

◆ qStringFromNSString()

static QString qStringFromNSString ( NSString *  nsstring)
static

Definition at line 52 of file main.mm.

Referenced by documentsDirectory(), and main().

53 {
54  return QString::fromUtf8([nsstring UTF8String]);
55 }
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
Definition: qstring.cpp:4302