0

I am trying to implement double click showmaximized / showNormal for my QDialog widget title bar. The dialog has to contain ContextHelpButton, so it's impossible to combine it with Qt::Window,Qt::WindowMaximizeButtonHint and Qt::WindowMinimizeButtonHint flags. I don't need the buttons to maximize and showNormal, only double click on title bar functional.

There was a great post to catch mouse click event on titlebar area Qt detecting mouse click on titleBar (Windows) I've managed to call showMaximized() and showNormal() inside native enent.

But similar functional has to work for Linux. Still haven't found the "double click on title bar" event name to catch on Linux.

I implemented small macro to divide functional for Windows and Linux. Hope it will work.

#ifdef Q_OS_WIN
    // Windows functional
#endif
#ifdef Q_OS_LINUX
    // linux functional
#endif

I've read a lot of similar posts, but I still haven't found a solution which would work in my conditions. Maybe someone has struggled with the same proplem, please help.

3
  • Note that while the double click to maximize/normalize a window is not an absolute convention: on Linux it completely depends on the window manager and the user configuration (for instance, it may shade the window), meaning that you should not assume that and do what you think would be valid. Have you tried to unset the Qt::Dialog window flag and just leave the others (including Qt::Window, obviously)? Commented Apr 24, 2024 at 18:51
  • Thanks for your answer! I've managed to use Qt::Window flag on Linux just because there is no context help button in QDialog by default. Commented May 2, 2024 at 14:03
  • Good, then I suggest you to answer your own question using the related button at the bottom of this post. Commented May 2, 2024 at 17:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.