QFileDialog is works but invisible
-
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.
-
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.
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.
-
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.
-
@sierdzio Thanks for answer, I try it but it doesn't work for me.
I have same problem it's work but it invisible. -
@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-Hilk
I find it hard to believe that he callsgetOpenFileNames()
, 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-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 trygetOpenFileName()
[singular] orgetSaveFileName()
? -
@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 trygetOpenFileName()
[singular] orgetSaveFileName()
? -
@Rudo1
Hmm, not good! But I don't think I follow: yes you show some "invisibility", butgetOpenFileNames()
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 demonstratesgetOpenFileNames()
is even being called? -
@Rudo1
Hmm, not good! But I don't think I follow: yes you show some "invisibility", butgetOpenFileNames()
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 demonstratesgetOpenFileNames()
is even being called? -
@Rudo1
No, we answer questions in the forum here, not personally.
You could explain how comeQFileDialog::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 howFirstWindow::on_action1_triggered()
gets called from what you show. -
@Rudo1
No, we answer questions in the forum here, not personally.
You could explain how comeQFileDialog::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 howFirstWindow::on_action1_triggered()
gets called from what you show. -
@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.
@Rudo1
Then I have no idea how what you describe relates to the screenshot you show, which has no popupQFileDialog
.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? -
@Rudo1
Then I have no idea how what you describe relates to the screenshot you show, which has no popupQFileDialog
.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? -
@Rudo1
Then I have no idea how what you describe relates to the screenshot you show, which has no popupQFileDialog
.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?@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".
-
@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".
-