QDialog is going behind QMainWindow after click on QMainWindow screen.......
-
Hi All,
I am developing one QT application, Where I am creating QMainWindow and have one push button on mainwindow.After clicking on push button, I am opening QDialog of fixed size.
Code snippet :
class TempDialog : public QDialog
{}
function :
void MainWindow::on_push_button_clicked() {
Dialog *dialog = new TempDialog(this);
dialog->setModal(true);
dialog->setWindowFlags(Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint |
Qt::WindowStayOnTopHint);
dialog->exec();
}So, When dialog gets created at that time it's on top of Main Window.
But problem is if we click on main window screen - then dialog is going behind mainwindow screen.
My requirement is like - I don't wont to move dialog behind mainwindow if we touch on mainwindow screen.
Note : My Mainwindow is full screen and Dialog is small square box on top of Mainwindow.
Please suggest me approach how to achieve.
I am using Linux wayland Display for output.
Thanks in advance.
-
@Milansinh-Vadher
So far as I know it should already stay on top, though I use Xorg not Wayland. Are you sure yourTempDialog
class does not alter something about the dialog?It is possible that there is some "desktop setting" which could alter dialog-topness-behaviour, I don't know.
You could also test with
Dialog *dialog = new TempDialog(nullptr);
. This would make the dialog application-modal instead of mainwindow-modal, just to see how that behaves.You could also remove your
Qt::WindowStayOnTopHint
, since that should be necessary, just in case that is actually making it go wrong. -
@JonB Yes i am sure it's not altering anything about dialog.
-
Hi and welcome to devnet,
Which Linux distribution are you using ?
Are you using a desktop environment and if so which is it ?
Which version of Qt are you using ?
Is it the one from your distribution ? -
Hi All,
It's got resolved. Issue was from weston-wayland side and for same weston has given patch.
After applying that patch issue got resolved.
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/210
Thanks all.