a0119ff1d2
1 OBS-URL: https://build.opensuse.org/request/show/501456 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtbase?expand=0&rev=59
106 lines
4.3 KiB
Diff
106 lines
4.3 KiB
Diff
From de63bbd2f806b0219a60775017899cedb121581f Mon Sep 17 00:00:00 2001
|
|
From: Alexander Volkov <a.volkov@rusbitech.ru>
|
|
Date: Wed, 9 Nov 2016 17:33:00 +0300
|
|
Subject: [PATCH] Add QPlatformTheme::standardButtonShortcut()
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
It allows to set shortcuts for the standard buttons in
|
|
QDialogButtonBox.
|
|
|
|
Restore Qt4's behavior for the "Don't Save" button on macOS
|
|
by setting a shortcut for it (it was Cmd-D before Lion,
|
|
now it's Cmd-Delete).
|
|
|
|
Change-Id: I6b56f68f37670962178693a8983d9fe550540856
|
|
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
|
|
---
|
|
src/gui/kernel/qplatformtheme.cpp | 13 +++++++++++++
|
|
src/gui/kernel/qplatformtheme.h | 1 +
|
|
src/plugins/platforms/cocoa/qcocoatheme.h | 1 +
|
|
src/plugins/platforms/cocoa/qcocoatheme.mm | 6 ++++++
|
|
src/widgets/widgets/qdialogbuttonbox.cpp | 7 +------
|
|
5 files changed, 22 insertions(+), 6 deletions(-)
|
|
|
|
Index: qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.cpp
|
|
===================================================================
|
|
--- qtbase-opensource-src-5.9.0.orig/src/gui/kernel/qplatformtheme.cpp
|
|
+++ qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.cpp
|
|
@@ -678,19 +678,6 @@ QString QPlatformTheme::standardButtonTe
|
|
return QPlatformTheme::defaultStandardButtonText(button);
|
|
}
|
|
|
|
-/*!
|
|
- Returns the mnemonic that should be used for a standard \a button.
|
|
-
|
|
- \since 5.9
|
|
- \sa QPlatformDialogHelper::StandardButton
|
|
- */
|
|
-
|
|
-QKeySequence QPlatformTheme::standardButtonShortcut(int button) const
|
|
-{
|
|
- Q_UNUSED(button)
|
|
- return QKeySequence();
|
|
-}
|
|
-
|
|
QString QPlatformTheme::defaultStandardButtonText(int button)
|
|
{
|
|
switch (button) {
|
|
Index: qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.h
|
|
===================================================================
|
|
--- qtbase-opensource-src-5.9.0.orig/src/gui/kernel/qplatformtheme.h
|
|
+++ qtbase-opensource-src-5.9.0/src/gui/kernel/qplatformtheme.h
|
|
@@ -312,7 +312,6 @@ public:
|
|
#endif
|
|
|
|
virtual QString standardButtonText(int button) const;
|
|
- virtual QKeySequence standardButtonShortcut(int button) const;
|
|
|
|
static QVariant defaultThemeHint(ThemeHint hint);
|
|
static QString defaultStandardButtonText(int button);
|
|
Index: qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.h
|
|
===================================================================
|
|
--- qtbase-opensource-src-5.9.0.orig/src/plugins/platforms/cocoa/qcocoatheme.h
|
|
+++ qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.h
|
|
@@ -74,7 +74,6 @@ public:
|
|
|
|
QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
|
|
QString standardButtonText(int button) const Q_DECL_OVERRIDE;
|
|
- QKeySequence standardButtonShortcut(int button) const Q_DECL_OVERRIDE;
|
|
|
|
static const char *name;
|
|
|
|
Index: qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.mm
|
|
===================================================================
|
|
--- qtbase-opensource-src-5.9.0.orig/src/plugins/platforms/cocoa/qcocoatheme.mm
|
|
+++ qtbase-opensource-src-5.9.0/src/plugins/platforms/cocoa/qcocoatheme.mm
|
|
@@ -344,12 +344,6 @@ QString QCocoaTheme::standardButtonText(
|
|
return button == QPlatformDialogHelper::Discard ? msgDialogButtonDiscard() : QPlatformTheme::standardButtonText(button);
|
|
}
|
|
|
|
-QKeySequence QCocoaTheme::standardButtonShortcut(int button) const
|
|
-{
|
|
- return button == QPlatformDialogHelper::Discard ? QKeySequence(Qt::CTRL | Qt::Key_Delete)
|
|
- : QPlatformTheme::standardButtonShortcut(button);
|
|
-}
|
|
-
|
|
QPlatformMenuItem *QCocoaTheme::createPlatformMenuItem() const
|
|
{
|
|
return new QCocoaMenuItem();
|
|
Index: qtbase-opensource-src-5.9.0/src/widgets/widgets/qdialogbuttonbox.cpp
|
|
===================================================================
|
|
--- qtbase-opensource-src-5.9.0.orig/src/widgets/widgets/qdialogbuttonbox.cpp
|
|
+++ qtbase-opensource-src-5.9.0/src/widgets/widgets/qdialogbuttonbox.cpp
|
|
@@ -410,9 +410,7 @@ QPushButton *QDialogButtonBoxPrivate::cr
|
|
qWarning("QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
|
|
else
|
|
addButton(button, static_cast<QDialogButtonBox::ButtonRole>(role), doLayout);
|
|
-#if QT_CONFIG(shortcut)
|
|
- button->setShortcut(QGuiApplicationPrivate::platformTheme()->standardButtonShortcut(sbutton));
|
|
-#endif
|
|
+
|
|
return button;
|
|
}
|
|
|