Closed FeiWang1119 closed 9 months ago
/*! \reimp qt5 widget */
void QPushButton::keyPressEvent(QKeyEvent *e)
{
Q_D(QPushButton);
switch (e->key()) {
case Qt::Key_Enter:
case Qt::Key_Return:
if (autoDefault() || d->defaultButton) {
click();
break;
}
Q_FALLTHROUGH();
default:
QAbstractButton::keyPressEvent(e);
}
}
bool QQuickAbstractButtonPrivate::acceptKeyClick(Qt::Key key) const
{
const auto buttonPressKeys = QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::ButtonPressKeys).value<QList<Qt::Key>>();
return buttonPressKeys.contains(key);
}
void QQuickAbstractButton::keyPressEvent(QKeyEvent *event)
{
Q_D(QQuickAbstractButton);
QQuickControl::keyPressEvent(event);
if (d->acceptKeyClick(static_cast<Qt::Key>(event->key()))) {
d->setPressPoint(d->centerPressPoint());
setPressed(true);
if (d->autoRepeat)
d->startRepeatDelay();
emit pressed();
event->accept();
}
}
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: FeiWang1119, kegechen
The full list of commands accepted by this bot can be found here.
add the keys Return/Enter support in deepintheme
Issue: https://github.com/linuxdeepin/developer-center/issues/5852