Asking user for folder creation in qt through dialog box .
-
How can i ask one user to create a folder through one dialog box in qt .
So that whatever the name the user has given in the dialog box ( in a specific location,
for eg. c:/user/...) the folder will be created in that location and if the folder is
alreday present with the specific name in that location then replacement shall be done .
-
Have you looked into this one in Qt "QFileDialog":http://qt-project.org/doc/qt-4.8/QFileDialog.html?
-
#include <QFileDialog>
QString fileName = QFileDialog::getOpenFileName(this, "Load Video",QString(),"Video (*.avi *.asf *.mpg *.wmv)"); -
If you talk about QFileDialog, you can do it like this:
@
QString dirPath = QFileDialog::getExistingDirectory(this, .....);
@or:
If you talk about code, you can do it like this:
@
MyDialog dial(this);
if(dial.exec()) {
QDir dir( somedir );
dir.mkdir( dial.dirNameWhichIgot() );
}
@This code will create dir (in somedir) with name got from MyDialog::dirNameWhichIgot() if execution of dialog was successful.
-
Thankx to all . i got the ans .. i have to use QFiledialog::getexistingdirectory()..
-
Now that, I appreciate you if you could prefix [SOLVED] to the topic so that others know that this issue is closed.