[PlasmaComponents Menu] Set WA_TranslucentBackground on the underlying QMenu

This ensures the menu can have nice round corners with Breeze and Oxygen. The same had already been done in ContainmentInterface's menu.

CHANGELOG: Fixed an issue where PlasmaComponents Menu would appear with broken corners

CCBUG: 381799

Differential Revision: https://phabricator.kde.org/D8965
This commit is contained in:
Kai Uwe Broulik 2017-11-24 10:40:48 +01:00
parent f395097fe9
commit facaaf93d0

View File

@ -38,6 +38,11 @@ QMenuProxy::QMenuProxy(QObject *parent)
{ {
if (qobject_cast<QApplication *>(QCoreApplication::instance())) { if (qobject_cast<QApplication *>(QCoreApplication::instance())) {
m_menu = new QMenu(0); m_menu = new QMenu(0);
// Breeze and Oxygen have rounded corners on menus. They set this attribute in polish()
// but at that time the underlying surface has already been created where setting this
// flag makes no difference anymore (Bug 385311)
m_menu->setAttribute(Qt::WA_TranslucentBackground);
KAcceleratorManager::manage(m_menu); KAcceleratorManager::manage(m_menu);
connect(m_menu, &QMenu::triggered, this, &QMenuProxy::itemTriggered); connect(m_menu, &QMenu::triggered, this, &QMenuProxy::itemTriggered);
connect(m_menu, &QMenu::aboutToHide, [ = ]() { connect(m_menu, &QMenu::aboutToHide, [ = ]() {