Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Error message with QFileDialog
Qt 6.11 is out! See what's new in the release blog

Error message with QFileDialog

Scheduled Pinned Locked Moved General and Desktop
8 Posts 3 Posters 6.7k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gabor53
    wrote on last edited by
    #1

    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.

    jsulmJ 1 Reply Last reply
    0
    • G gabor53

      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.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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)"));
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      G 1 Reply Last reply
      1
      • jsulmJ jsulm

        @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)"));
        
        G Offline
        G Offline
        gabor53
        wrote on last edited by
        #3

        @jsulm
        I did as you recommended. It works now (enters the folder and opens the file) but I still get the error messages.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          How are you using that delegate ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          G 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            How are you using that delegate ?

            G Offline
            G Offline
            gabor53
            wrote on last edited by gabor53
            #5

            @SGaist
            What do you mean?
            I use it to replace an image in the db.

            jsulmJ 1 Reply Last reply
            0
            • G gabor53

              @SGaist
              What do you mean?
              I use it to replace an image in the db.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @gabor53 Besides that error - does your application work?

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              G 1 Reply Last reply
              0
              • jsulmJ jsulm

                @gabor53 Besides that error - does your application work?

                G Offline
                G Offline
                gabor53
                wrote on last edited by
                #7

                @jsulm
                Yes. It works ok.

                jsulmJ 1 Reply Last reply
                0
                • G gabor53

                  @jsulm
                  Yes. It works ok.

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @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!)

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved