File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -1539,6 +1539,22 @@ bool DApplication::notify(QObject *obj, QEvent *event)
1539
1539
}
1540
1540
}
1541
1541
1542
+ // Qt 6.4 引入了 QPlatformTheme::ThemeHint::ButtonPressKeys
1543
+ // 可以通过主题插件 themeHint 返回一个按键列表,按钮应该响应列表中的按键
1544
+ // see https://github.com/linuxdeepin/qt5integration/pull/20
1545
+ #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
1546
+ if (event->type () == QEvent::KeyPress && obj == focusWidget ()) {
1547
+ if (auto keyEvent = dynamic_cast <QKeyEvent *>(event)) {
1548
+ if (keyEvent->key () == Qt::Key_Return || keyEvent->key () == Qt::Key_Enter) {
1549
+ if (auto btn = qobject_cast<QAbstractButton *>(obj)) {
1550
+ Q_EMIT btn->clicked ();
1551
+ return true ;
1552
+ }
1553
+ }
1554
+ }
1555
+ }
1556
+ #endif
1557
+
1542
1558
if (event->type () == QEvent::ApplicationFontChange) {
1543
1559
// ApplicationFontChange 调用 font() 是 ok 的,如果在 fontChanged 中调用在某些版本中会出现 deadlock
1544
1560
DFontSizeManager::instance ()->setFontGenericPixelSize (static_cast <quint16>(DFontSizeManager::fontPixelSize (font ())));
You can’t perform that action at this time.
0 commit comments