| ID | ... | Creation date | 10 January 2009 |
| Platform | S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition | Tested on devices | Emulator |
| Category | Qt for Symbian | Subcategory | Dir command |
| Keywords (APIs, classes, methods, functions): QDir |
This code snippet demonstrates how to use QDir in Qt for S60.
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Size | QDir::Reversed);
makepath = "d://test"; dir.mkpath(makepath);
More About QDir visit: http://pepper.troll.no/s60prereleases/doc/qdir.html#mkpath
#include <QDir>
#include <QWidget>
#include <QVBoxLayout>
#include <QString>
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
QDir dir;
QVBoxLayout *layout = new QVBoxLayout;
QWidget *win = new QWidget;
QLabel *label = new QLabel;
QLabel *label1 = new QLabel;
dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks);
dir.setSorting(QDir::Size | QDir::Reversed);
QString current,setpath,newdir,newpath,makepath;
makepath = "d://test";
dir.mkdir(hello);
dir.mkpath(makepath); // This command creates all sub folder to make a specific path.
newdir="mydir";
current=dir.currentPath(); // Returns the current path of the application working directory
setpath="d://test";
dir.cdUp();
dir.setPath(setpath); // Sets the path to the setpath string
newpath=dir.currentPath();
dir.mkdir(newdir); // The directory would be created in d://test
label->setText(current);
label1->setText(newpath);
layout->addWidget(label);
layout->addWidget(label1);
win->setLayout(layout);
win->show();
return app.exec();
}
More About QDir visit: http://pepper.troll.no/s60prereleases/doc/qdir.html#mkpath
No related wiki articles found