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 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.4k 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.
  • 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
                                  • saitejS Offline
                                    saitejS Offline
                                    saitej
                                    wrote on last edited by
                                    #27

                                    @mrjj @micland @kshegunov

                                    Hi guys

                                    I have boiled down the error to a line which when commented the filedialog works but I don't see any reason how that line is effecting the filedialog. I will need that line in my project so if someone can tell me how it is affecting the filedialog, It will be very helpful.

                                    Thanks

                                     ui->sideLayout->addWidget(wid1,Qt::AlignBottom);
                                    

                                    This line adds a widget to the sidelayout which is a vertical layout added in the mainwindow.ui file through the designer.

                                    Note: There are other layouts along with the side layout but they are not influencing

                                    1 Reply Last reply
                                    0
                                    • mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #28

                                      hi
                                      That is like epic strange.
                                      What type is wid1 ?

                                      saitejS 1 Reply Last reply
                                      0
                                      • mrjjM mrjj

                                        hi
                                        That is like epic strange.
                                        What type is wid1 ?

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

                                        @mrjj

                                        :)
                                        It's a custom class widget to display variables on real time

                                        mrjjM 1 Reply Last reply
                                        0
                                        • saitejS saitej

                                          @mrjj

                                          :)
                                          It's a custom class widget to display variables on real time

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

                                          @saitej
                                          Just for test.
                                          Could you try with a normal QpushButton for wid1 just to see if
                                          it was something to do with the actual widget.
                                          My brain cannot find any reason that a layout should do stuff to a dialog.?!

                                          saitejS 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