Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkwidget
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkwidget.

Source-pull-request: linuxdeepin/dtkwidget#569
  • Loading branch information
deepin-ci-robot committed May 7, 2024
1 parent 620faab commit e56aa85
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/widgets/dapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,19 @@ bool DApplication::notify(QObject *obj, QEvent *event)
}
}

#if QT_VERSION < QT_VERSION_CHECK(6, 4, 0)
if (event->type() == QEvent::KeyPress && obj == focusWidget()) {
if (auto keyEvent = dynamic_cast<QKeyEvent *>(event)) {
if (keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Enter) {
if (auto btn = qobject_cast<QAbstractButton *>(obj)) {
Q_EMIT btn->clicked();
return true;
}
}
}
}
#endif

if (event->type() == QEvent::ApplicationFontChange) {
// ApplicationFontChange 调用 font() 是 ok 的,如果在 fontChanged 中调用在某些版本中会出现 deadlock
DFontSizeManager::instance()->setFontGenericPixelSize(static_cast<quint16>(DFontSizeManager::fontPixelSize(font())));
Expand Down

0 comments on commit e56aa85

Please sign in to comment.