QFileDialog in Dynamic Plugin

Asked by Dhiraj Salian

Hello Guys,
I am creating a dynamic plugin and i want to include a QFileDialog on button press.I am facing problems in creating it.Here's the code and screenshot.

code:
void OSPMainDialog :: openScript(){
 QString moduleDirectoryPath = StelFileMgr::getUserDir() + "/modules/OpenSkyPlanetarium";
 if(!StelFileMgr::exists(moduleDirectoryPath)){
  StelFileMgr::mkDir(moduleDirectoryPath);
 }
 QString fileName = QFileDialog::getOpenFileName(dialog,tr("Open Script"), moduleDirectoryPath, tr("Script Files (*.osp)"));
 if(!fileName.isNull()){
 QFile f(fileName);
 ui->scriptEdit->setText(f.readAll());
 }
}

screenshot:
https://s25.postimg.org/5y0bwhynj/Screenshot_from_2016_07_15_12_45_32.png

Question information

Language:
English Edit question
Status:
Solved
For:
Stellarium Edit question
Assignee:
No assignee Edit question
Solved by:
Alexander Wolf
Solved:
Last query:
Last reply:
Revision history for this message
Best Alexander Wolf (alexwolf) said :
#2

QString fileName = QFileDialog::getOpenFileName(NULL, tr("Open Script"), moduleDirectoryPath, tr("Script Files (*.osp)"));

Revision history for this message
Dhiraj Salian (redcoder265) said :
#4

Thanks Alexander Wolf, that solved my question.