Reputation: 1
I'm trying to make transparent QMenu in QCalendarWidget. I know how to implement it in QMenuBar, but I don't know in QCalendarWidget.
It would be great if it's possible to blur the background of QMenu
I hope someone can help me.
self.ui.calendarWidget.setAttribute(Qt.WA_TranslucentBackground)
self.ui.calendarWidget.setWindowFlags(self.ui.calendarWidget.windowFlags() | Qt.FramelessWindowHint | Qt.NoDropShadowWindowHint)
This is what I was trying to do.
Upvotes: 0
Views: 185
Reputation: 21
You can work around things by modifying QCalendarWidget grandchildren.
child = self.name.findChild(QWidget, 'qt_calendar_navigationbar')
grandchild = child.findChild(QHBoxLayout)
There you can modify margins to have space for round corners and apply setStyleSheet
.
grandchild.setStyleSheet('border-radius: 10px;'
'background-color: black;')
Similarly you will be able to access all children to modify children widget.
To know what is what, I used the source code along with print(self.name.children())
.
Upvotes: 2