Make QKeySequence work on Mac.

Replace WS_MAC with OS_MAC.

Change-Id: I28a7f7cb65b61f00a3a12f3b257a553b511f85af
Reviewed-on: http://codereview.qt-project.org/4353
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Liang Qi <liang.qi@nokia.com>
bb10
Morten Sorvig 2011-09-07 13:58:39 +02:00 committed by Liang Qi
parent 9360ee1605
commit 7ad91ad9ca
2 changed files with 14 additions and 14 deletions

View File

@ -1213,7 +1213,7 @@ QInputPanel *QGuiApplication::inputPanel() const
uint QGuiApplicationPrivate::currentKeyPlatform()
{
uint platform = KB_Win;
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
platform = KB_Mac;
#elif defined Q_WS_X11
platform = KB_X11;

View File

@ -54,14 +54,14 @@
#endif
#include "qvariant.h"
#ifdef Q_WS_MAC
# include <private/qt_mac_p.h>
#ifdef Q_OS_MAC
#include <QtCore/private/qcore_mac_p.h>
#include <Carbon/Carbon.h>
#endif
QT_BEGIN_NAMESPACE
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
static bool qt_sequence_no_mnemonics = true;
struct MacSpecialKey {
int key;
@ -967,7 +967,7 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence)
d->ref.ref();
}
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
static inline int maybeSwapShortcut(int shortcut)
{
if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
@ -999,7 +999,7 @@ QList<QKeySequence> QKeySequence::keyBindings(StandardKey key)
QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i];
if (keyBinding.standardKey == key && (keyBinding.platform & platform)) {
uint shortcut =
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
maybeSwapShortcut(QKeySequencePrivate::keyBindings[i].shortcut);
#else
QKeySequencePrivate::keyBindings[i].shortcut;
@ -1201,7 +1201,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
if (nativeText) {
gmodifs = globalModifs();
if (gmodifs->isEmpty()) {
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
if (dontSwap)
*gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode));
@ -1241,7 +1241,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
modifs += *gmodifs; // Test non-translated ones last
QString sl = accel;
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
for (int i = 0; i < modifs.size(); ++i) {
const QModifKeyName &mkf = modifs.at(i);
if (sl.contains(mkf.name)) {
@ -1277,7 +1277,7 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
int fnum = 0;
if (accel.length() == 1) {
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
int qtKey = qtkeyForMacSymbol(accel[0]);
if (qtKey != -1) {
ret |= qtKey;
@ -1335,7 +1335,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
{
bool nativeText = (format == QKeySequence::NativeText);
QString s;
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
if (nativeText) {
// On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
// If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
@ -1391,7 +1391,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
: QString::fromLatin1("F%1").arg(key - Qt::Key_F1 + 1);
} else if (key) {
int i=0;
#if defined(Q_WS_MAC)
#if defined(Q_OS_MAC)
if (nativeText) {
QChar ch = qt_macSymbolForQtKey(key);
if (!ch.isNull())
@ -1401,7 +1401,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
} else
#endif
{
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
NonSymbol:
#endif
while (keyname[i].name) {
@ -1427,7 +1427,7 @@ NonSymbol:
}
}
#ifdef Q_WS_MAC
#ifdef Q_OS_MAC
if (nativeText)
s += p;
else