How is it possible to make rounded edges for QMainWindow?
-
Hi everyone, how is it possible to make rounded edges for QMainWindow?
I use QSS, specifically:border: 1px solid black; border-radius: 10px;
I want to do something like this:
But it turns out like this:
Why is that? And how can this be done?
Thank you in advance! -
Hi
You can look here
https://doc.qt.io/qt-5/qtwidgets-widgets-shapedclock-example.htmlthe main thing is they use a mask
QRegion maskedRegion(width() / 2 - side / 2, height() / 2 - side / 2, side, side, QRegion::Ellipse); setMask(maskedRegion);
It cannot be done with QSS for top level windows.
Outside such custom Windows, it's not really possible to alter how Windows looks like as it's the OS
that controls that. Not Qt.
That is why the window is still a rect in your picture.It often takes a huge amount of code to have a custom window if you at the same time wants it to be like any other window
on that platform.See here how much code to have a frameless window on Windows and macOS
https://github.com/Bringer-of-Light/Qt-Nice-Frameless-WindowLinux is rarely supported as its flexibility to what actually draws the windows, makes it very hard to write that work across them all.