[Solved] QDialog set as child will not show
If I construct a QDialog as a child of my main window and I also call setWindowFlags on the dialog it will not become visible when I call show(). Is there something I am doing wrong? The code is just
Now if I set the dialog back as it’s own top-level window it will show just fine, but I want it to be a child dialog so it doesn’t add another entry to the taskbar and it will auto-center in the middle of the mainwindow.
Ok, so that didn’t really help. All that did was once again make the dialog have its own taskbar entry which is not what I want. This makes no sense. And yes, what you specify does work but I want to have the dialog only have a title and no ? or close buttons which the setWindowFlags call is for getting. I know from reading the docs that the setWindowFlags call makes the window hidden but the call to the dialog’s show method doesn’t seem to have any effect.
That’s the constructor of the OpenVobDialog class since I moved the setWindowFlags call into the constructor. In the initialization list of the qmainwindow class I added this:
in the list to construct the object. Also when the button is clicked it calls into this slot:
- void mainwindow::on_openVobButton_clicked()
I’ve even added lines that pops up a message box after the show call that provides info on the isHidden and isVisible state and they both say true even after the show call. For some reason it is not changing the isHidden state.