1 Attachment(s)
QFilediaog assertion failure
Hi,
I am building my GUI app on Qt 4.5.3. when i try to copy/insert any values in the linedit of QFileDialog, There will be a prompt of assertion failure from visual studio 2005. Could you please let me know how to fix this issue.
Here is the simple code,
Code:
QFileDialog l_pFiledDlg
(this, tr
("Open Files"), sPath, tr
("All Files (*)"));
if (l_pFiledDlg.exec()) sFilename1 = l_pFiledDlg.selectedFiles()[0];
I have also attached a snapshot of the assertion failure dialog. :confused:
Re: QFilediaog assertion failure
Hi,
Any information you need, let me know such that I can narrow down the scope of issue. I have both the versions ofQt 4.5.3 and 4.4.0 are installed but I made sure it neatly compiled and linked with Qt 4.5.3.
And one more thing It works fine in Release mode. IS there would be any Debug visual studio settings ?. Let me know if you
get anything related to this.
Thanks,
Nikhil
Re: QFilediaog assertion failure
Does it still happen if you comment out:
l_pFiledDlg.setFileMode(QFileDialog::ExistingFile) ;
Quote:
And one more thing It works fine in Release mode.
the assertion dialog only pops up in debug build.
The release build ignores it.
You can choose "Ignore" on the dialog and the application will continue to run in debug mode too.
Re: QFilediaog assertion failure
Thanks for the reply. Yes it happens even after commenting out,
Re: QFilediaog assertion failure
It does not happens if I use the static method,
Code:
QFileDialog::getOpenFileName(this,tr
("Open Files"),sPath,tr
("All Files (*.*)"));
Quote:
QFileDialog l_pFiledDlg(this, tr("Open Files"), sPath, tr("All Files (*)"));
QString sFilename1;
l_pFiledDlg.setViewMode(QFileDialog:: Detail);
l_pFiledDlg.setFileMode(QFileDialog::ExistingFile) ;
if (l_pFiledDlg.exec()) sFilename1 = l_pFiledDlg.selectedFiles()[0];
The main intention of using this part of the QFileDialog code is, I want to use detailed view, which cannot be set by using static method.
Re: QFilediaog assertion failure
Can you show the whole function that has the code section you posted?
It "smells" like its a problem of variable getting out of scope.
Re: QFilediaog assertion failure
Code:
Util.readFilepath(sPath);
QFileDialog l_pFiledDlg
(this, tr
("Open Files"), sPath, tr
("All Files (*)"));
if (l_pFiledDlg.exec()) sFilename3 = l_pFiledDlg.selectedFiles()[0];
The function contains only this little part of it.
Quote:
It "smells" like its a problem of variable getting out of scope.
Which variable are you talking about ?
Re: QFilediaog assertion failure
You are getting the selection in to 'sFilename3 ', and not do with it anything... ?!
Re: QFilediaog assertion failure
I will the pass the filename to the fileparser which no way link with the functionality of the file dialog open, right ?.
Quote:
You are getting the selection in to 'sFilename3 ', and not do with it anything... ?!
Since QFileDialog enters eventloop. The assertion failure happens even before I(code) get the control.
Re: QFilediaog assertion failure
Quote:
I will the pass the filename to the fileparser
This means its not the whole code in the function.
Do you want help or not?
I have no time to guess what your mistake is.
You should offer all the information you can so that we can help you.
Re: QFilediaog assertion failure
I need help. I just asked you whether it anyways helps you. Please do not interpret wrongly. Here is the entire code in the function,
Code:
Util.readFilepath(sPath);
QFileDialog l_pFiledDlg
(this, tr
("Open Files"), sPath, tr
("All Files (*)"));
if (l_pFiledDlg.exec()) sFilename3 = l_pFiledDlg.selectedFiles()[0];
if( sFilename3.isEmpty() )
return;
m_sFilename3 = sFilename3;
Util.storeFilepath(m_sFilename3);
m_pLineEdit3->setText(m_sFilename3);
validateandParseLineEdit3(m_sFilename3);
Re: QFilediaog assertion failure
Is the parent of the dialog visible when this slot is executed?
Re: QFilediaog assertion failure
Yes the parent is visible.
Re: QFilediaog assertion failure
Hmm...
Try the following:
let the dialog popup, and just close it with cancel.
Then, have it popup again, and try to edit the filename, see if it still has the error.
It might be also a bug in Qt. you might want to check the bug tracker.
At the moment, I don't see any problem in the code you posted.
Re: QFilediaog assertion failure
Thanks. I will look into it. Please let me know if anything you get related to it.