Hi,

I'm writing a QML application in which I would like to use a ListView to show a list of files. I tried to use as model for my ListView the QFileSystemModel as it is shown in the following code samples:

main.cpp
#include <QQmlContext>
#include <QtGui/QGuiApplication>
#include <QDir>
#include <QFileSystemModel>
#include "qtquick2applicationviewer.h"

int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);

QFileSystemModel* model = new QFileSystemModel();
model->setFilter(QDir::NoDotAndDotDot | QDir::Files);
model->setRootPath("C:/Images");

QtQuick2ApplicationViewer viewer;

viewer.rootContext()->setContextProperty("myFileModel", model);

viewer.setMainQmlFile(QStringLiteral("qml/ProvaQML/main.qml"));
viewer.showExpanded();

return app.exec();
}
main.qml
import QtQuick 2.0

Item
{
id: main
width: 1024
height: 768

FileList
{
x_start: parent.x
y_start: parent.y
}
}
FileList.qml
import QtQuick 2.2

ListView
{
property int x_start: 0
property int y_start: 0

x: x_start + 20
y: y_start + 100

width: 210
height: 290

model: myFileModel

delegate: Rectangle{
width: 210; height: 20; radius: 5; border.width: 2; border.color: "orange"; color: "yellow";
Text { text: fileName; anchors.centerIn: parent }
}
}
Unfortunatly when I try to run my application I receive a Segmentation Fault error and in my QML/JS Console i read:
ASSERT: "!"No style available without QApplication!"" in file kernel\qapplication.cpp, line 962 global\qglobal.cpp: 2096
Does anyone know which is the problem and how to fix it?

Thanks

Enrico