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 is works but invisible
Forum Updated to NodeBB v4.3 + New Features

QFileDialog is works but invisible

Scheduled Pinned Locked Moved Solved General and Desktop
20 Posts 5 Posters 1.3k Views 1 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.
  • R Offline
    R Offline
    Rudo1
    wrote on last edited by
    #1

    Hello,

    I have build a project under Ubuntu 22.04 / Qt Creator and Qt 6.4.2 GCC 64 bit.

    I have problem with QFileDialog, I use this code in my mainwindow.cpp

    void FirstWindow::on_action1_triggered()
    {
    QStringList archive = QFileDialog::getOpenFileNames(this, "Archive",
    QDir::rootPath());
    const int mArchive = archive.size();
    for (int i = 0; i < mArchive; ++i)
    {
    addMedia(archive.at(i));
    }
    }

    I mean that it's works but visibility is invisible or have transparent backgraund.

    sierdzioS 1 Reply Last reply
    0
    • R Rudo1

      Hello,

      I have build a project under Ubuntu 22.04 / Qt Creator and Qt 6.4.2 GCC 64 bit.

      I have problem with QFileDialog, I use this code in my mainwindow.cpp

      void FirstWindow::on_action1_triggered()
      {
      QStringList archive = QFileDialog::getOpenFileNames(this, "Archive",
      QDir::rootPath());
      const int mArchive = archive.size();
      for (int i = 0; i < mArchive; ++i)
      {
      addMedia(archive.at(i));
      }
      }

      I mean that it's works but visibility is invisible or have transparent backgraund.

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      You can remove the parent:

      const auto archive = QFileDialog::getOpenFileNames(nullptr, "Archive", QDir::rootPath());
      

      Downside of this is it won't center on your app window.

      (Z(:^

      R 1 Reply Last reply
      0
      • sierdzioS sierdzio

        You can remove the parent:

        const auto archive = QFileDialog::getOpenFileNames(nullptr, "Archive", QDir::rootPath());
        

        Downside of this is it won't center on your app window.

        R Offline
        R Offline
        Rudo1
        wrote on last edited by Rudo1
        #3

        @sierdzio Thanks for answer, I try it but it doesn't work for me.
        I have same problem it's work but it invisible.

        JonBJ 1 Reply Last reply
        0
        • R Rudo1

          @sierdzio Thanks for answer, I try it but it doesn't work for me.
          I have same problem it's work but it invisible.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Rudo1
          If the dialog is "invisible" how do you even know that it "works"? Maybe a screenshot of what you might mean by "invisible"?

          J.HilkJ 1 Reply Last reply
          1
          • JonBJ JonB

            @Rudo1
            If the dialog is "invisible" how do you even know that it "works"? Maybe a screenshot of what you might mean by "invisible"?

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by
            #5

            @JonB silly goose, @Rudo1 can't screen shot what's invisible. Dooh 🤪


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            JonBJ 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @JonB silly goose, @Rudo1 can't screen shot what's invisible. Dooh 🤪

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by
              #6

              @J-Hilk
              I find it hard to believe that he calls getOpenFileNames(), says it works, but is completely invisible. How would he know it had "worked"? He talks about "or have transparent backgraund", maybe that means it shows something?

              J.HilkJ 1 Reply Last reply
              0
              • JonBJ JonB

                @J-Hilk
                I find it hard to believe that he calls getOpenFileNames(), says it works, but is completely invisible. How would he know it had "worked"? He talks about "or have transparent backgraund", maybe that means it shows something?

                J.HilkJ Offline
                J.HilkJ Offline
                J.Hilk
                Moderators
                wrote on last edited by
                #7

                @JonB you took my comment waaaay too serious


                Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                Q: What's that?
                A: It's blue light.
                Q: What does it do?
                A: It turns blue.

                JonBJ 1 Reply Last reply
                1
                • J.HilkJ J.Hilk

                  @JonB you took my comment waaaay too serious

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @J-Hilk
                  Ooohh! :) Well, maybe OP can post an invisible screenshot of the invisible dialog? ;-)

                  @Rudo1 You are using QFileDialog::getOpenFileNames(). Do you get the same result if you try getOpenFileName() [singular] or getSaveFileName()?

                  R 2 Replies Last reply
                  1
                  • JonBJ JonB

                    @J-Hilk
                    Ooohh! :) Well, maybe OP can post an invisible screenshot of the invisible dialog? ;-)

                    @Rudo1 You are using QFileDialog::getOpenFileNames(). Do you get the same result if you try getOpenFileName() [singular] or getSaveFileName()?

                    R Offline
                    R Offline
                    Rudo1
                    wrote on last edited by
                    #9

                    @JonB Yes, I tried it and nothing.

                    But I try it on other Ubuntu 22.04, with Qt 5.15.3 and it works.
                    I install Qt 5.15.3 on my ubuntu, and try it, but it doesn't working.

                    1 Reply Last reply
                    0
                    • JonBJ JonB

                      @J-Hilk
                      Ooohh! :) Well, maybe OP can post an invisible screenshot of the invisible dialog? ;-)

                      @Rudo1 You are using QFileDialog::getOpenFileNames(). Do you get the same result if you try getOpenFileName() [singular] or getSaveFileName()?

                      R Offline
                      R Offline
                      Rudo1
                      wrote on last edited by
                      #10

                      @JonB Screenshot from 2023-02-28 14-07-14.png

                      JonBJ 1 Reply Last reply
                      0
                      • R Rudo1

                        @JonB Screenshot from 2023-02-28 14-07-14.png

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by
                        #11

                        @Rudo1
                        Hmm, not good! But I don't think I follow: yes you show some "invisibility", but getOpenFileNames() etc. are dialogs which pop up. They would not have your "button furniture", what you show is your own window/dialog, I don't see what you press to cause the "open files" dialog to pop up? I don't see how what you are showing demonstrates getOpenFileNames() is even being called?

                        R 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @Rudo1
                          Hmm, not good! But I don't think I follow: yes you show some "invisibility", but getOpenFileNames() etc. are dialogs which pop up. They would not have your "button furniture", what you show is your own window/dialog, I don't see what you press to cause the "open files" dialog to pop up? I don't see how what you are showing demonstrates getOpenFileNames() is even being called?

                          R Offline
                          R Offline
                          Rudo1
                          wrote on last edited by
                          #12

                          @JonB I can show you if you give me your skype or other communication tool.

                          JonBJ 1 Reply Last reply
                          0
                          • R Rudo1

                            @JonB I can show you if you give me your skype or other communication tool.

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by
                            #13

                            @Rudo1
                            No, we answer questions in the forum here, not personally.
                            You could explain how come QFileDialog::get...() pop up a file selector dialog while what you show seemingly has no popup dialog but instead shows a blank area in an existing widget. And you could also explain how FirstWindow::on_action1_triggered() gets called from what you show.

                            R 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @Rudo1
                              No, we answer questions in the forum here, not personally.
                              You could explain how come QFileDialog::get...() pop up a file selector dialog while what you show seemingly has no popup dialog but instead shows a blank area in an existing widget. And you could also explain how FirstWindow::on_action1_triggered() gets called from what you show.

                              R Offline
                              R Offline
                              Rudo1
                              wrote on last edited by
                              #14

                              @JonB In my UI I have seperator, and on_action1_triggered is action of it, when I click to seperator I must have open QFileDialog and select .mp4 file in list. I try it in new project and it works, but in my project it doesn't work.

                              JonBJ 1 Reply Last reply
                              0
                              • R Rudo1

                                @JonB In my UI I have seperator, and on_action1_triggered is action of it, when I click to seperator I must have open QFileDialog and select .mp4 file in list. I try it in new project and it works, but in my project it doesn't work.

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by JonB
                                #15

                                @Rudo1
                                Then I have no idea how what you describe relates to the screenshot you show, which has no popup QFileDialog.

                                If you say it works in a standalone program but not your code then you have the answer: you are presumably doing something wrong in your code. Reduce/build it up compared to a standalone example which works to find out what. Have you yet even verified it does call your FirstWindow::on_action1_triggered() at all?

                                R jsulmJ 2 Replies Last reply
                                1
                                • JonBJ JonB

                                  @Rudo1
                                  Then I have no idea how what you describe relates to the screenshot you show, which has no popup QFileDialog.

                                  If you say it works in a standalone program but not your code then you have the answer: you are presumably doing something wrong in your code. Reduce/build it up compared to a standalone example which works to find out what. Have you yet even verified it does call your FirstWindow::on_action1_triggered() at all?

                                  R Offline
                                  R Offline
                                  Rudo1
                                  wrote on last edited by
                                  #16

                                  @JonB Okay, thanks for your time, if I will solve this problem, I will write about it.

                                  JonBJ 1 Reply Last reply
                                  0
                                  • R Rudo1

                                    @JonB Okay, thanks for your time, if I will solve this problem, I will write about it.

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by
                                    #17

                                    @Rudo1
                                    I would start by placing a qDebug() statement in on_action1_triggered(), I am not convinced it is called.

                                    1 Reply Last reply
                                    0
                                    • JonBJ JonB

                                      @Rudo1
                                      Then I have no idea how what you describe relates to the screenshot you show, which has no popup QFileDialog.

                                      If you say it works in a standalone program but not your code then you have the answer: you are presumably doing something wrong in your code. Reduce/build it up compared to a standalone example which works to find out what. Have you yet even verified it does call your FirstWindow::on_action1_triggered() at all?

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

                                      @JonB said in QFileDialog is works but invisible:

                                      Then I have no idea how what you describe relates to the screenshot you show, which has no popup QFileDialog

                                      It actually has: look at the bottom, it is next to "FirstWindow" and is called "Archive".

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

                                      JonBJ 1 Reply Last reply
                                      2
                                      • jsulmJ jsulm

                                        @JonB said in QFileDialog is works but invisible:

                                        Then I have no idea how what you describe relates to the screenshot you show, which has no popup QFileDialog

                                        It actually has: look at the bottom, it is next to "FirstWindow" and is called "Archive".

                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on last edited by
                                        #19

                                        @jsulm OIC!! Very odd.

                                        R 1 Reply Last reply
                                        0
                                        • JonBJ JonB

                                          @jsulm OIC!! Very odd.

                                          R Offline
                                          R Offline
                                          Rudo1
                                          wrote on last edited by
                                          #20

                                          @JonB Thanks for help, I solved it, I called other method in my constructor and it was blocking everything.

                                          1 Reply Last reply
                                          0
                                          • R Rudo1 has marked this topic as solved on

                                          • Login

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