PDA

View Full Version : Problem with QFileDialog and getOpenfileName method.



robgeek
2nd April 2015, 02:54
Hello!

Somebody, please, tell me why i'm getting the following error message when i try to run my program:

#include <QFileDialog>
#include <QString>
//...code...
void MyData::on_openButton_clicked( )
{
QString filePath = QFileDialog::getOpenfileName(this, tr("Open File"), "D:/Texts/", tr("Text Files (*.txt)"));
//...rest of the code
}


D:\Programming\C-C++\Qt\Windows\mydata.cpp:43: error: 'getOpenfileName' is not a member of 'QFileDialog'
QString filePath = QFileDialog::getOpenfileName(this, tr("Open File"), "D:/Texts/", tr("Text Files (*.txt)"));
^

Thanks!

jefftee
2nd April 2015, 03:03
Because the static method is named QFileDialog::getOpenFileDialog? (pay close attention to the case)

Edit: That's a compile error too, not a run-time error, correct?

robgeek
2nd April 2015, 04:04
Problem fixed.

Here my error:
"getOpenfileName" is with "F" in FileName.

Sorry, and thank you for trying to help me.