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. QFileDialog->getOpenFileName() errors in debugger.
Qt 6.11 is out! See what's new in the release blog

QFileDialog->getOpenFileName() errors in debugger.

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 3 Posters 4.7k Views 3 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.
  • mzimmersM mzimmers

    @kshegunov said in QFileDialog->getOpenFileName() errors in debugger.:

    @mzimmers said in QFileDialog->getOpenFileName() errors in debugger.:

    When I run the code below in the debugger

    Why are you calling a static function like an object method to begin with?

    I'm not sure I understand your question; what should I be doing differently?

    mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #7

    @mzimmers
    Hi, the function is static, meaning it call be called WITHOUT an object instance ( qfd in this case )
    alt text

    notice the syntax in sample.

    1 Reply Last reply
    2
    • mzimmersM mzimmers

      @kshegunov said in QFileDialog->getOpenFileName() errors in debugger.:

      @mzimmers said in QFileDialog->getOpenFileName() errors in debugger.:

      When I run the code below in the debugger

      Why are you calling a static function like an object method to begin with?

      I'm not sure I understand your question; what should I be doing differently?

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #8

      Well, the thing is that qfd has no meaning in your case. QFileDialog::getOpenFileName is a static function, thus it neither requires nor it takes into account any object of type QFileDialog. What you ordinarily do is just call it as a regular function:

      QString filename = QFileDialog::getOpenFileName( .... )
      

      PS.

      <rant>
      I has annoyed me for ages that in the Qt docs you see the following application skeleton:

      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
          return app.exec();
      }
      

      It is misleading! QCoreApplication::exec is a static function!
      </rant>

      Read and abide by the Qt Code of Conduct

      1 Reply Last reply
      1
      • mzimmersM Offline
        mzimmersM Offline
        mzimmers
        wrote on last edited by
        #9

        OK, thanks for the explanation. I changed it per your example -- behavior is unchanged.

        kshegunovK mrjjM 2 Replies Last reply
        0
        • mzimmersM mzimmers

          OK, thanks for the explanation. I changed it per your example -- behavior is unchanged.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by
          #10

          I imagine so, it's just an oddity. The point was you understand that whatever you do to the object has no bearing on the QFileDialog::getOpenFileName.

          My first advice would've been to try the Qt dialog, but apparently that's not the problem. Second thing that comes to mind is to try the regular way of opening the dialog, i.e. using show on an initialized object. Third thing you could try is to disable the side pane of the dialog (I'm too lazy to check the docs for the correct flag, but I'm sure you can manage that).

          Read and abide by the Qt Code of Conduct

          mzimmersM 1 Reply Last reply
          1
          • mzimmersM mzimmers

            OK, thanks for the explanation. I changed it per your example -- behavior is unchanged.

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #11

            @mzimmers
            Just to know.
            Which compiler are you using ?

            mzimmersM 1 Reply Last reply
            0
            • mrjjM mrjj

              @mzimmers
              Just to know.
              Which compiler are you using ?

              mzimmersM Offline
              mzimmersM Offline
              mzimmers
              wrote on last edited by
              #12

              @mrjj MinGW5.3.0 32bit for C++

              mrjjM 1 Reply Last reply
              0
              • mzimmersM mzimmers

                @mrjj MinGW5.3.0 32bit for C++

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #13

                @mzimmers
                ok, just the one that comes with Qt ?
                Could you try a clean default GUI project and just a pushbutton with
                QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
                "/home",
                tr("Images (*.png *.xpm *.jpg)"));
                to see if it always says it or it somehow is related to your code ?

                mzimmersM 1 Reply Last reply
                1
                • mrjjM mrjj

                  @mzimmers
                  ok, just the one that comes with Qt ?
                  Could you try a clean default GUI project and just a pushbutton with
                  QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
                  "/home",
                  tr("Images (*.png *.xpm *.jpg)"));
                  to see if it always says it or it somehow is related to your code ?

                  mzimmersM Offline
                  mzimmersM Offline
                  mzimmers
                  wrote on last edited by
                  #14

                  @mrjj

                  Got this:

                  onecoreuap\shell\windows.storage\sharedstoragesources\util.cpp(2831)\windows.storage.dll!764FCA21: (caller: 7655AA74) ReturnHr(1) tid(2fc8) 80070490 Element not found.
                      CallContext:[\CAutoDestItemsEnum::Next\CAutoDestItemsEnum::_EnsureInit] 
                  onecoreuap\shell\windows.storage\homefolder.cpp(504)\windows.storage.dll!768C5FE8: (caller: 76603224) ReturnHr(2) tid(2fc8) 80004002 No such interface supported
                  onecoreuap\shell\windows.storage\kfapi\folderpathidlistcache.cpp(208)\windows.storage.dll!764809CC: (caller: 7647FC1C) LogHr(1) tid(2198) 80070002 The system cannot find the file specified.
                  

                  The LogHr message repeated 64 times.

                  kshegunovK 1 Reply Last reply
                  0
                  • mzimmersM mzimmers

                    @mrjj

                    Got this:

                    onecoreuap\shell\windows.storage\sharedstoragesources\util.cpp(2831)\windows.storage.dll!764FCA21: (caller: 7655AA74) ReturnHr(1) tid(2fc8) 80070490 Element not found.
                        CallContext:[\CAutoDestItemsEnum::Next\CAutoDestItemsEnum::_EnsureInit] 
                    onecoreuap\shell\windows.storage\homefolder.cpp(504)\windows.storage.dll!768C5FE8: (caller: 76603224) ReturnHr(2) tid(2fc8) 80004002 No such interface supported
                    onecoreuap\shell\windows.storage\kfapi\folderpathidlistcache.cpp(208)\windows.storage.dll!764809CC: (caller: 7647FC1C) LogHr(1) tid(2198) 80070002 The system cannot find the file specified.
                    

                    The LogHr message repeated 64 times.

                    kshegunovK Offline
                    kshegunovK Offline
                    kshegunov
                    Moderators
                    wrote on last edited by
                    #15

                    How did you install Qt?

                    Look also at QTBUG-67711 and QTBUG-63789. Probably what you're hitting.

                    Read and abide by the Qt Code of Conduct

                    mzimmersM 1 Reply Last reply
                    4
                    • kshegunovK kshegunov

                      How did you install Qt?

                      Look also at QTBUG-67711 and QTBUG-63789. Probably what you're hitting.

                      mzimmersM Offline
                      mzimmersM Offline
                      mzimmers
                      wrote on last edited by
                      #16

                      @kshegunov: very interesting. I probably installed Qt via the maintenance tool, though I'm not 100% sure. I don't mind removing and re-installing, but would you suggest using the maintenance tool, or just downloading from the web site?

                      kshegunovK 1 Reply Last reply
                      0
                      • mzimmersM mzimmers

                        @kshegunov: very interesting. I probably installed Qt via the maintenance tool, though I'm not 100% sure. I don't mind removing and re-installing, but would you suggest using the maintenance tool, or just downloading from the web site?

                        kshegunovK Offline
                        kshegunovK Offline
                        kshegunov
                        Moderators
                        wrote on last edited by
                        #17

                        Actually I would've suggested trying building the library yourself. I'm not sure if you're going to get enough bang for the buck though, even if it helps at all; building Qt on windows is somewhat finicky ...

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply
                        1
                        • mzimmersM Offline
                          mzimmersM Offline
                          mzimmers
                          wrote on last edited by
                          #18

                          Yeah, I think I'll just live with it until it gets shaken out. My primary concern was that I was doing something wrong; if it's a library mismatch, I can ignore the symptoms, especially since they don't occur outside of the debugger.

                          Thanks, all.

                          1 Reply Last reply
                          3
                          • kshegunovK kshegunov

                            I imagine so, it's just an oddity. The point was you understand that whatever you do to the object has no bearing on the QFileDialog::getOpenFileName.

                            My first advice would've been to try the Qt dialog, but apparently that's not the problem. Second thing that comes to mind is to try the regular way of opening the dialog, i.e. using show on an initialized object. Third thing you could try is to disable the side pane of the dialog (I'm too lazy to check the docs for the correct flag, but I'm sure you can manage that).

                            mzimmersM Offline
                            mzimmersM Offline
                            mzimmers
                            wrote on last edited by
                            #19

                            @kshegunov said in QFileDialog->getOpenFileName() errors in debugger.:

                            Second thing that comes to mind is to try the regular way of opening the dialog, i.e. using show on an initialized object.

                            What did you mean by this? I'm ready to try something new.

                            kshegunovK 1 Reply Last reply
                            0
                            • mzimmersM mzimmers

                              @kshegunov said in QFileDialog->getOpenFileName() errors in debugger.:

                              Second thing that comes to mind is to try the regular way of opening the dialog, i.e. using show on an initialized object.

                              What did you mean by this? I'm ready to try something new.

                              kshegunovK Offline
                              kshegunovK Offline
                              kshegunov
                              Moderators
                              wrote on last edited by
                              #20

                              @mzimmers said in QFileDialog->getOpenFileName() errors in debugger.:

                              What did you mean by this? I'm ready to try something new.

                              QFileDialog * dialog = new QFileDialog(this);
                              dialog->setNameFilters(...);
                              // ... more ...
                              dialog->show();
                              

                              Read and abide by the Qt Code of Conduct

                              1 Reply Last reply
                              1

                              • Login

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