How is it possible to make rounded edges for QMainWindow?
-
wrote on 26 Jun 2021, 15:10 last edited by sepera_okeq
-
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.
-
wrote on 9 Aug 2024, 20:32 last edited by
Just add this :
setAttribute(Qt::WA_TranslucentBackground); -
wrote on 2 Nov 2024, 20:59 last edited by
@kokokaz insane fix, thanks.