diff options
author | Jake Petroules <jake.petroules@qt.io> | 2017-03-03 16:58:52 -0800 |
---|---|---|
committer | Jake Petroules <jake.petroules@qt.io> | 2017-03-07 01:04:40 +0000 |
commit | c1058cfd7b713ce91938439ab5bf945fd46dc803 (patch) | |
tree | 05027e8eac12894e528b9a83aa96a53db821e9cd | |
parent | e0e956bfc2cb418ca95e06f3f0f4d863a518fc6b (diff) |
Remove remaining Carbon includes from QtCore, QtGui and QtWidgets
Carbon is deprecated and we should not rely on it at runtime or compile
time. These headers were only included for a small collection of
keyboard key constants which have now been hardcoded instead.
Change-Id: Ia2eaa267584b63be8019be3bbf64cba897a985a8
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
-rw-r--r-- | src/corelib/kernel/qcore_mac_objc.mm | 4 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 8 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibility.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoatheme.mm | 2 | ||||
-rw-r--r-- | src/widgets/doc/snippets/macmainwindow.mm | 2 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp | 12 | ||||
-rw-r--r-- | tests/auto/other/macnativeevents/macnativeevents.pro | 3 | ||||
-rw-r--r-- | tests/auto/other/macnativeevents/qnativeevents_mac.cpp | 2 | ||||
-rw-r--r-- | tests/auto/other/macnativeevents/tst_macnativeevents.cpp | 6 | ||||
-rw-r--r-- | tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro | 1 | ||||
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/qwidget.pro | 2 |
11 files changed, 26 insertions, 20 deletions
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm index 231afb991c..a91c02f54e 100644 --- a/src/corelib/kernel/qcore_mac_objc.mm +++ b/src/corelib/kernel/qcore_mac_objc.mm @@ -42,7 +42,6 @@ #ifdef Q_OS_OSX #include <AppKit/NSText.h> -#include <Carbon/Carbon.h> #endif #include <qdebug.h> @@ -140,6 +139,7 @@ struct qtKey2CocoaKeySortLessThan } }; +static const int NSEscapeCharacter = 27; // not defined by Cocoa headers static const int NumEntries = 59; static const KeyPair entries[NumEntries] = { { NSEnterCharacter, Qt::Key_Enter }, @@ -148,7 +148,7 @@ static const KeyPair entries[NumEntries] = { { NSNewlineCharacter, Qt::Key_Return }, { NSCarriageReturnCharacter, Qt::Key_Return }, { NSBackTabCharacter, Qt::Key_Backtab }, - { kEscapeCharCode, Qt::Key_Escape }, + { NSEscapeCharacter, Qt::Key_Escape }, // Cocoa sends us delete when pressing backspace! // (NB when we reverse this list in qtKey2CocoaKey, there // will be two indices of Qt::Key_Backspace. But is seems to work diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index a6bc7d4d9c..1a106be98b 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -56,7 +56,6 @@ #if defined(Q_OS_MACX) #include <QtCore/private/qcore_mac_p.h> -#include <Carbon/Carbon.h> #endif #include <algorithm> @@ -70,6 +69,13 @@ struct MacSpecialKey { ushort macSymbol; }; +// Unicode code points for the glyphs associated with these keys +// Defined by Carbon headers but not anywhere in Cocoa +static const int kShiftUnicode = 0x21E7; +static const int kControlUnicode = 0x2303; +static const int kOptionUnicode = 0x2325; +static const int kCommandUnicode = 0x2318; + static const int NumEntries = 21; static const MacSpecialKey entries[NumEntries] = { { Qt::Key_Escape, 0x238B }, diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm index b15c486e9d..8b6dcb35a6 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm @@ -41,8 +41,6 @@ #include <QtGui/qaccessible.h> #include <private/qcore_mac_p.h> -#include <Carbon/Carbon.h> - QT_BEGIN_NAMESPACE #ifndef QT_NO_ACCESSIBILITY @@ -369,7 +367,7 @@ id getValueAttribute(QAccessibleInterface *interface) QString text; if (interface->state().passwordEdit) { // return round password replacement chars - text = QString(end, QChar(kBulletUnicode)); + text = QString(end, QChar(0x2022)); } else { // VoiceOver will read out the entire text string at once when returning // text as a value. For large text edits the size of the returned string diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index d2345f9abc..ad2b27999b 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -330,7 +330,7 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const case IconPixmapSizes: return QVariant::fromValue(QCocoaFileIconEngine::availableIconSizes()); case QPlatformTheme::PasswordMaskCharacter: - return QVariant(QChar(kBulletUnicode)); + return QVariant(QChar(0x2022)); case QPlatformTheme::UiEffects: return QVariant(int(HoverEffect)); default: diff --git a/src/widgets/doc/snippets/macmainwindow.mm b/src/widgets/doc/snippets/macmainwindow.mm index d848e6442d..c63796a3f2 100644 --- a/src/widgets/doc/snippets/macmainwindow.mm +++ b/src/widgets/doc/snippets/macmainwindow.mm @@ -43,8 +43,6 @@ #if 0 // Used to be included in Qt4 for Q_WS_MAC -#include <Carbon/Carbon.h> - //![0] SearchWidget::SearchWidget(QWidget *parent) : QMacCocoaViewContainer(0, parent) diff --git a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp index 6394a956bd..f8b6bf064a 100644 --- a/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp +++ b/tests/auto/gui/kernel/qkeysequence/tst_qkeysequence.cpp @@ -36,14 +36,18 @@ #include <QLibraryInfo> #ifdef Q_OS_MAC -#ifdef Q_OS_OSX -#include <Carbon/Carbon.h> -#endif struct MacSpecialKey { int key; ushort macSymbol; }; +// Unicode code points for the glyphs associated with these keys +// Defined by Carbon headers but not anywhere in Cocoa +static const int kShiftUnicode = 0x21E7; +static const int kControlUnicode = 0x2303; +static const int kOptionUnicode = 0x2325; +static const int kCommandUnicode = 0x2318; + static const int NumEntries = 21; static const MacSpecialKey entries[NumEntries] = { { Qt::Key_Escape, 0x238B }, @@ -61,12 +65,10 @@ static const MacSpecialKey entries[NumEntries] = { { Qt::Key_Down, 0x2193 }, { Qt::Key_PageUp, 0x21DE }, { Qt::Key_PageDown, 0x21DF }, -#ifdef Q_OS_OSX { Qt::Key_Shift, kShiftUnicode }, { Qt::Key_Control, kCommandUnicode }, { Qt::Key_Meta, kControlUnicode }, { Qt::Key_Alt, kOptionUnicode }, -#endif { Qt::Key_CapsLock, 0x21EA }, }; diff --git a/tests/auto/other/macnativeevents/macnativeevents.pro b/tests/auto/other/macnativeevents/macnativeevents.pro index 48ad04bbff..0611377d0b 100644 --- a/tests/auto/other/macnativeevents/macnativeevents.pro +++ b/tests/auto/other/macnativeevents/macnativeevents.pro @@ -1,9 +1,8 @@ CONFIG += testcase TARGET = tst_macnativeevents -LIBS += -framework Carbon QT += widgets testlib HEADERS += qnativeevents.h nativeeventlist.h expectedeventlist.h -SOURCES += qnativeevents.cpp qnativeevents_mac.cpp +SOURCES += qnativeevents.cpp qnativeevents_mac.cpp SOURCES += expectedeventlist.cpp nativeeventlist.cpp SOURCES += tst_macnativeevents.cpp diff --git a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp index 2d35be03ab..6d7fbbecc1 100644 --- a/tests/auto/other/macnativeevents/qnativeevents_mac.cpp +++ b/tests/auto/other/macnativeevents/qnativeevents_mac.cpp @@ -27,7 +27,7 @@ ****************************************************************************/ #include "qnativeevents.h" -#include <Carbon/Carbon.h> +#include <CoreGraphics/CoreGraphics.h> #include <QtCore> // ************************************************************ diff --git a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp index 1624b3065b..b5db966bd9 100644 --- a/tests/auto/other/macnativeevents/tst_macnativeevents.cpp +++ b/tests/auto/other/macnativeevents/tst_macnativeevents.cpp @@ -35,10 +35,14 @@ #include "qnativeevents.h" #include "nativeeventlist.h" #include "expectedeventlist.h" -#include <Carbon/Carbon.h> QT_USE_NAMESPACE +// Unicode code points for the glyphs associated with these keys +// Defined by Carbon headers but not anywhere in Cocoa +static const int kControlUnicode = 0x2303; +static const int kCommandUnicode = 0x2318; + class tst_MacNativeEvents : public QObject { Q_OBJECT diff --git a/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro index ceed81c914..e55757775e 100644 --- a/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro +++ b/tests/auto/other/qaccessibilitymac/qaccessibilitymac.pro @@ -1,6 +1,5 @@ CONFIG += testcase TARGET = tst_qaccessibilitymac -# LIBS += -framework Carbon QT += widgets testlib HEADERS += tst_qaccessibilitymac_helpers.h diff --git a/tests/auto/widgets/kernel/qwidget/qwidget.pro b/tests/auto/widgets/kernel/qwidget/qwidget.pro index 499ca65516..0e95d454cf 100644 --- a/tests/auto/widgets/kernel/qwidget/qwidget.pro +++ b/tests/auto/widgets/kernel/qwidget/qwidget.pro @@ -12,7 +12,7 @@ aix-g++*:QMAKE_CXXFLAGS+=-fpermissive CONFIG += x11inc mac { - LIBS += -framework Security -framework AppKit -framework Carbon + LIBS += -framework Security -framework AppKit OBJECTIVE_SOURCES += tst_qwidget_mac_helpers.mm } |