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>
bb10
Jake Petroules 2017-03-03 16:58:52 -08:00
parent e0e956bfc2
commit c1058cfd7b
11 changed files with 26 additions and 20 deletions

View File

@ -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

View File

@ -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 },

View File

@ -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

View File

@ -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:

View File

@ -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)

View File

@ -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 },
};

View File

@ -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

View File

@ -27,7 +27,7 @@
****************************************************************************/
#include "qnativeevents.h"
#include <Carbon/Carbon.h>
#include <CoreGraphics/CoreGraphics.h>
#include <QtCore>
// ************************************************************

View File

@ -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

View File

@ -1,6 +1,5 @@
CONFIG += testcase
TARGET = tst_qaccessibilitymac
# LIBS += -framework Carbon
QT += widgets testlib
HEADERS += tst_qaccessibilitymac_helpers.h

View File

@ -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
}