1 #include "ProxyStyle.h"
2 
3 #include <QMenu>
4 
5 namespace U2 {
6 
ProxyStyle(QStyle * style)7 ProxyStyle::ProxyStyle(QStyle *style)
8     : QProxyStyle(style) {
9 }
10 
polish(QWidget * widget)11 void ProxyStyle::polish(QWidget *widget) {
12     QProxyStyle::polish(widget);
13 
14 #if QT_VERSION_CHECK(5, 10, 0) < QT_VERSION
15     // It's a workaround for https://bugreports.qt.io/browse/QTBUG-49435:
16     // shortcuts are not shown in context menus.
17     auto *menu = qobject_cast<QMenu *>(widget);
18     if (nullptr != menu) {
19         const auto actions = menu->actions();
20         for (auto *action : qAsConst(actions)) {
21             action->setShortcutVisibleInContextMenu(true);
22         }
23     }
24 #endif
25 }
26 
27 }  // namespace U2
28