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

QFileDialog Error

Scheduled Pinned Locked Moved Unsolved General and Desktop
35 Posts 5 Posters 30.8k 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.
  • saitejS saitej

    @micland

    No. Its the mainwindow already holding several widgets. Yes, the dialog shows up in full screen and also I am unable to resize it from the bottom

    miclandM Offline
    miclandM Offline
    micland
    wrote on last edited by
    #7

    @saitej
    Hm, I think the reason for the display problem is the fact that the dialog is in fullsize mode (I'm not sure if this is really supported - on the other hand there's no reason why it should lead to a mixed up layout). And I have no idea why the dialog runs in fullscreen.
    Could you try once to pass NULL instead of this just to see if the dialog layout changes?

    saitejS 1 Reply Last reply
    1
    • miclandM micland

      @saitej
      Hm, I think the reason for the display problem is the fact that the dialog is in fullsize mode (I'm not sure if this is really supported - on the other hand there's no reason why it should lead to a mixed up layout). And I have no idea why the dialog runs in fullscreen.
      Could you try once to pass NULL instead of this just to see if the dialog layout changes?

      saitejS Offline
      saitejS Offline
      saitej
      wrote on last edited by
      #8

      @micland

      I tried by passing NULL and also made sure the mainwindow is not maximized but still same problem persists

      1 Reply Last reply
      0
      • mrjjM mrjj

        @saitej

        Ok. so it is your project somehow?!?

        And this happens as shoow as it open the dialog?

        Does it only do it on ubuntu?
        (the same code)

        saitejS Offline
        saitejS Offline
        saitej
        wrote on last edited by
        #9

        @mrjj

        I tried the same code in the same system. It works on a new project but not on an existing one. I am unable to find a valid reason for this unusual behaviour

        mrjjM 1 Reply Last reply
        1
        • saitejS saitej

          @mrjj

          I tried the same code in the same system. It works on a new project but not on an existing one. I am unable to find a valid reason for this unusual behaviour

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

          @saitej
          ok. its really , really odd.

          Could you try with the
          QFileDialog::DontUseNativeDialog
          flag and see if its the ubuntu dialog that is strange?

          saitejS 2 Replies Last reply
          1
          • mrjjM mrjj

            @saitej
            ok. its really , really odd.

            Could you try with the
            QFileDialog::DontUseNativeDialog
            flag and see if its the ubuntu dialog that is strange?

            saitejS Offline
            saitejS Offline
            saitej
            wrote on last edited by
            #11

            @mrjj
            It didn't work :(

            mrjjM 1 Reply Last reply
            0
            • mrjjM mrjj

              @saitej
              ok. its really , really odd.

              Could you try with the
              QFileDialog::DontUseNativeDialog
              flag and see if its the ubuntu dialog that is strange?

              saitejS Offline
              saitejS Offline
              saitej
              wrote on last edited by
              #12

              @mrjj

              I will try to implement the same in qml. How to open file dialog in qml through a slot/function?

              1 Reply Last reply
              0
              • saitejS saitej

                @mrjj
                It didn't work :(

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

                @saitej

                Same thing happens even with flag?

                Hmm. I really have no idea what can do this.

                Also since it works normally in default app and
                the static call is the same.

                Have you tried some of the other dialogs ? like COlorDIalog?

                saitejS 1 Reply Last reply
                1
                • mrjjM mrjj

                  @saitej

                  Same thing happens even with flag?

                  Hmm. I really have no idea what can do this.

                  Also since it works normally in default app and
                  the static call is the same.

                  Have you tried some of the other dialogs ? like COlorDIalog?

                  saitejS Offline
                  saitejS Offline
                  saitej
                  wrote on last edited by
                  #14

                  @mrjj
                  Nope. Any links would help

                  mrjjM 1 Reply Last reply
                  0
                  • saitejS saitej

                    @mrjj
                    Nope. Any links would help

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

                    @saitej

                    Its like the getOpenFileName, just to get a color and not a filename.

                    http://doc.qt.io/qt-5/qcolordialog.html

                    I just wonder if that is funky too.

                    saitejS 2 Replies Last reply
                    0
                    • mrjjM mrjj

                      @saitej

                      Its like the getOpenFileName, just to get a color and not a filename.

                      http://doc.qt.io/qt-5/qcolordialog.html

                      I just wonder if that is funky too.

                      saitejS Offline
                      saitejS Offline
                      saitej
                      wrote on last edited by
                      #16

                      @mrjj

                      @saitej said:

                      @mrjj

                      I will try to implement the same in qml. How to open file dialog in qml through a slot/function?

                      I want links for this

                      1 Reply Last reply
                      0
                      • mrjjM mrjj

                        @saitej

                        Its like the getOpenFileName, just to get a color and not a filename.

                        http://doc.qt.io/qt-5/qcolordialog.html

                        I just wonder if that is funky too.

                        saitejS Offline
                        saitejS Offline
                        saitej
                        wrote on last edited by
                        #17

                        @mrjj
                        QColorDialog works fine!!

                        mrjjM 1 Reply Last reply
                        0
                        • saitejS saitej

                          @mrjj
                          QColorDialog works fine!!

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

                          @saitej
                          Ok very strange..

                          Im not into QML but this seems to be sample
                          http://doc.qt.io/qt-5/qml-qtquick-dialogs-filedialog.html#details

                          saitejS 1 Reply Last reply
                          1
                          • mrjjM mrjj

                            @saitej
                            Ok very strange..

                            Im not into QML but this seems to be sample
                            http://doc.qt.io/qt-5/qml-qtquick-dialogs-filedialog.html#details

                            saitejS Offline
                            saitejS Offline
                            saitej
                            wrote on last edited by
                            #19

                            @mrjj

                            Thanks!!

                            I tried through QML also but am getting the same result.

                            miclandM 1 Reply Last reply
                            0
                            • saitejS saitej

                              @mrjj

                              Thanks!!

                              I tried through QML also but am getting the same result.

                              miclandM Offline
                              miclandM Offline
                              micland
                              wrote on last edited by
                              #20

                              @saitej
                              That's really strange. Can your share a minimal runnable code example so that other users can try to reproduce the behaviour on their platforms?

                              1 Reply Last reply
                              0
                              • saitejS Offline
                                saitejS Offline
                                saitej
                                wrote on last edited by
                                #21

                                I think this guy might have faced a similar problem. The code that works for him doesnot work for me :( .

                                mrjjM 1 Reply Last reply
                                0
                                • saitejS saitej

                                  I think this guy might have faced a similar problem. The code that works for him doesnot work for me :( .

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

                                  @saitej
                                  But you call the function on a menu click?
                                  not in mainwin constructor ?

                                  since it just in that project, im out of ideas. your Qt should be fine.

                                  saitejS 1 Reply Last reply
                                  0
                                  • mrjjM mrjj

                                    @saitej
                                    But you call the function on a menu click?
                                    not in mainwin constructor ?

                                    since it just in that project, im out of ideas. your Qt should be fine.

                                    saitejS Offline
                                    saitejS Offline
                                    saitej
                                    wrote on last edited by
                                    #23

                                    @mrjj
                                    Ya!!

                                    1 Reply Last reply
                                    0
                                    • saitejS saitej

                                      @micland

                                      No. Its the mainwindow already holding several widgets. Yes, the dialog shows up in full screen and also I am unable to resize it from the bottom

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

                                      @saitej
                                      Hi,'

                                      Yes, the dialog shows up in full screen and also I am unable to resize it from the bottom

                                      It sounds like the event loop is blocked. I don't see how that might be happening from your snippet, but perhaps you could post the rest of the code - the whole method and how it's called?

                                      Kind regards.

                                      Read and abide by the Qt Code of Conduct

                                      saitejS 1 Reply Last reply
                                      0
                                      • jerome_isAviableJ Offline
                                        jerome_isAviableJ Offline
                                        jerome_isAviable
                                        wrote on last edited by
                                        #25

                                        did you try to use the debug mode for track errors and see variables instances ?
                                        Is your two differents projects has same files contents (or the second project is just a test case maybe ?). If this two projects are new, then use a tool for compare files contents to show differences appears.
                                        then... you could also try to use valgrind tool from qtcreator.

                                        1 Reply Last reply
                                        0
                                        • kshegunovK kshegunov

                                          @saitej
                                          Hi,'

                                          Yes, the dialog shows up in full screen and also I am unable to resize it from the bottom

                                          It sounds like the event loop is blocked. I don't see how that might be happening from your snippet, but perhaps you could post the rest of the code - the whole method and how it's called?

                                          Kind regards.

                                          saitejS Offline
                                          saitejS Offline
                                          saitej
                                          wrote on last edited by saitej
                                          #26

                                          @mrjj @micland @kshegunov

                                          Mainwindow.cpp

                                          QAction *loadfile = new QAction("Load File",this);
                                          ui->menuWidgets->addAction(loadfile);
                                          
                                          connect(loadfile, SIGNAL(triggered(bool)),this,SLOT(onLoadfile()));
                                          
                                          void MainWindow::onLoadfile(){
                                              QString fileName = QFileDialog::getOpenFileName(this,
                                                                                                  tr("Open File"),QDir::homePath() , tr("Kml Files (*.kml)"));
                                                  qDebug() << "Loading File"<< fileName;
                                                  QFile file( fileName );
                                                  if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
                                                      return;
                                          }
                                          
                                          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
                                          • Unsolved