PDA

View Full Version : Creating a new folder in QML



mohanakannan
6th June 2013, 15:33
Hi friends,
I want to create a new folder in Qml…So i found out it via Qt…..so i want to integrate this below Qt C++ with Qml…..How is it possible…

QDir dir(“path/to/dir”);
if (!dir.exists()) { dir.mkpath(”.”);
}
Or else,is there any options for creating new folder directly in Qml…Please suggest a solutions.Thanks in advance.

wysota
6th June 2013, 16:06
QML has no direct access to the filesystem. If you need such functionality you have to expose it to the QML engine from C++.

mohanakannan
7th June 2013, 12:05
QML has no direct access to the filesystem. If you need such functionality you have to expose it to the QML engine from C++.
Sorry for late reply Mr.Wysota.I have tried only by passing strings,but i don't know how to do it...Can u please show me example..

wysota
7th June 2013, 15:52
Create a subclass of QObject and expose all the functionality you need as slots of the subclass. Then expose the object to QML engine's root context using QQmlContext::setContextProperty().