Error message with QFileDialog
-
Hi,
I have the following function (I used the same in a QDialog without any problems):QPixmap myDelegate::getNewPix() { QString sPath = "C:/"; QFileDialog *fileDialog = new QFileDialog; fileDialog->getOpenFileName (Q_NULLPTR,sPath); fileName = fileDialog->getOpenFileName(Q_NULLPTR, tr("Finding Friend's replacement Image"),sPath, tr("Image Files (*.png *.jpg *.bmp)")); if(fileName == "") { qDebug() << "No image was chosen."; // QMessageBox::warning (this,"Error 1039","No image was choosen!"); } else { qDebug() << "Image was chosen!"; } QPixmap returnImage(fileName); QFile file(fileName); if(file.open (QIODevice::ReadOnly)) { qDebug() << "File is open!"; fixByteArray = file.readAll (); } else { qDebug() << "File is not open!"; } return returnImage; }
When the file search window opens and I click on any of the folders I get the following error message in Application Output:
onecoreuap\shell\ext\thumbnailcache\lib\thumbcacheapi.cpp(285)\thumbcache.dll!5E1AFEFF: (caller: 5E19EF51) ReturnHr(1) tid(bf8) 80004005 Unspecified error.
Is this because it is not a QDialog but a delegate? Any way to eliminate it? Thank you for your help. -
@gabor53 getOpenFileName is a static method (http://doc.qt.io/qt-5/qfiledialog.html#getOpenFileName), that means you do not need a QFileDialog instance:
fileName = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Finding Friend's replacement Image"),sPath, tr("Image Files (*.png *.jpg *.bmp)"));
-
@jsulm
I did as you recommended. It works now (enters the folder and opens the file) but I still get the error messages. -
Hi,
How are you using that delegate ?
-
@SGaist
What do you mean?
I use it to replace an image in the db. -
@gabor53 Besides that error - does your application work?
-
@jsulm
Yes. It works ok. -
@gabor53 I think this error is not related to Qt. It is thumbnail functionality in Windows.
You can try to delete files in: C:\Users\YOUR_USER_NAME\AppData\Local\Microsoft\Windows\Explorer
(make copy of that files before deleting!)