macOS: Remove all use of deprecated Q_OS_OSX define

Change-Id: I49c285604694c93d37c9d1c7cd6d3b1509858319
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-04-03 12:45:36 +02:00
parent 7e7c649884
commit ab4c22d47d
48 changed files with 117 additions and 117 deletions

View File

@ -183,7 +183,7 @@ MainWindow::MainWindow(QWidget *parent)
bottomBar->addWidget((uploadLimitLabel = new QLabel(tr("0 KB/s"))));
uploadLimitLabel->setFixedSize(QSize(fm.horizontalAdvance(tr("99999 KB/s")), fm.lineSpacing()));
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
setUnifiedTitleAndToolBarOnMac(true);
#endif

View File

@ -111,7 +111,7 @@ void Window::setVisible(bool visible)
//! [2]
void Window::closeEvent(QCloseEvent *event)
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (!event->spontaneous() || !isVisible()) {
return;
}

View File

@ -120,7 +120,7 @@ void MainWindow::actionTriggered(QAction *action)
void MainWindow::setupToolBar()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
setUnifiedTitleAndToolBarOnMac(true);
#endif
@ -178,7 +178,7 @@ void MainWindow::setupMenuBar()
for (int i = 0; i < toolBars.count(); ++i)
toolBarMenu->addMenu(toolBars.at(i)->toolbarMenu());
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
toolBarMenu->addSeparator();
action = toolBarMenu->addAction(tr("Unified"));

View File

@ -96,7 +96,7 @@ const QString rsrcPath = ":/images/win";
TextEdit::TextEdit(QWidget *parent)
: QMainWindow(parent)
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
setUnifiedTitleAndToolBarOnMac(true);
#endif
setWindowTitle(QCoreApplication::applicationName());

View File

@ -157,10 +157,10 @@ void MainWindow::createActions()
QAction *openIniFileAct = fileMenu->addAction(tr("Open I&NI File..."), this, &MainWindow::openIniFile);
openIniFileAct->setShortcut(tr("Ctrl+N"));
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QAction *openPropertyListAct = fileMenu->addAction(tr("Open Apple &Property List..."), this, &MainWindow::openPropertyList);
openPropertyListAct->setShortcut(tr("Ctrl+P"));
#endif // Q_OS_OSX
#endif // Q_OS_MACOS
#ifdef Q_OS_WIN
QAction *openRegistryPathAct = fileMenu->addAction(tr("Open Windows &Registry Path..."), this, &MainWindow::openRegistryPath);

View File

@ -2101,7 +2101,7 @@ QT_WARNING_DISABLE_DEPRECATED
QSysInfo::MacVersion QSysInfo::macVersion()
{
const auto version = QOperatingSystemVersion::current();
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
return QSysInfo::MacVersion(Q_MV_OSX(version.majorVersion(), version.minorVersion()));
#elif defined(Q_OS_IOS)
return QSysInfo::MacVersion(Q_MV_IOS(version.majorVersion(), version.minorVersion()));

View File

@ -69,7 +69,7 @@
# include <CoreFoundation/CFBundle.h>
#endif
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <CoreServices/CoreServices.h>
#endif

View File

@ -58,7 +58,7 @@
# include "qfilesystemwatcher_inotify_p.h"
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
# include "qfilesystemwatcher_kqueue_p.h"
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
# include "qfilesystemwatcher_fsevents_p.h"
#endif
@ -79,7 +79,7 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
return QInotifyFileSystemWatcherEngine::create(parent);
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
return QKqueueFileSystemWatcherEngine::create(parent);
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
return QFseventsFileSystemWatcherEngine::create(parent);
#else
Q_UNUSED(parent);

View File

@ -199,7 +199,7 @@ void QFseventsFileSystemWatcherEngine::processEvent(ConstFSEventStreamRef stream
const FSEventStreamEventFlags eventFlags[],
const FSEventStreamEventId eventIds[])
{
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
Q_UNUSED(streamRef);
bool needsRestart = false;

View File

@ -68,7 +68,7 @@
#include <signal.h> // kill
#include <unistd.h> // gethostname
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
# include <libproc.h>
#elif defined(Q_OS_LINUX)
# include <unistd.h>
@ -222,7 +222,7 @@ bool QLockFilePrivate::isProcessRunning(qint64 pid, const QString &appname)
QString QLockFilePrivate::processNameByPid(qint64 pid)
{
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
char name[1024];
proc_name(pid, name, sizeof(name) / sizeof(char));
return QFile::decodeName(name);

View File

@ -458,7 +458,7 @@ QMacRootLevelAutoReleasePool::~QMacRootLevelAutoReleasePool()
// -------------------------------------------------------------------------
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Use this method to keep all the information in the TextSegment. As long as it is ordered
// we are in OK shape, and we can influence that ourselves.
@ -598,7 +598,7 @@ Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode)
return i->qtKey;
}
#endif // Q_OS_OSX
#endif // Q_OS_MACOS
void qt_apple_check_os_version()
{

View File

@ -48,7 +48,7 @@
#include <limits>
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
# include <AppKit/NSApplication.h>
#elif defined(Q_OS_WATCHOS)
# include <WatchKit/WatchKit.h>

View File

@ -57,7 +57,7 @@
#include <QVector>
#if QT_CONFIG(icu)
#include <unicode/ucol.h>
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
#include <CoreServices/CoreServices.h>
#elif defined(Q_OS_WIN)
#include <qt_windows.h>
@ -70,7 +70,7 @@ typedef UCollator *CollatorType;
typedef QByteArray CollatorKeyType;
const CollatorType NoCollator = nullptr;
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
typedef CollatorRef CollatorType;
typedef QVector<UCCollationValue> CollatorKeyType;
const CollatorType NoCollator = 0;

View File

@ -2320,7 +2320,7 @@ void QGuiApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyE
static bool menuKeyPressAccepted = false;
#endif
#if !defined(Q_OS_OSX)
#if !defined(Q_OS_MACOS)
// FIXME: Include OS X in this code path by passing the key event through
// QPlatformInputContext::filterEvent().
if (e->keyType == QEvent::KeyPress && window) {

View File

@ -1288,7 +1288,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
QString p = keyName(key, format);
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
if (nativeText)
s += p;
else

View File

@ -979,7 +979,7 @@ QPlatformDialogHelper::ButtonRole QPlatformDialogHelper::buttonRole(QPlatformDia
const int *QPlatformDialogHelper::buttonLayout(Qt::Orientation orientation, ButtonLayout policy)
{
if (policy == UnknownLayout) {
#if defined (Q_OS_OSX)
#if defined (Q_OS_MACOS)
policy = MacLayout;
#elif defined (Q_OS_LINUX) || defined (Q_OS_UNIX)
policy = KdeLayout;

View File

@ -498,7 +498,7 @@ QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, QEvent::Type
QT_DEFINE_QPA_EVENT_HANDLER(bool, handleKeyEvent, QWindow *window, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text, bool autorep, ushort count)
{
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
if (t == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(window, timestamp, k, mods, 0, 0, 0, text, autorep, count))
return true;
#endif
@ -526,7 +526,7 @@ bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *window, ulong times
const QString& text, bool autorep,
ushort count, bool tryShortcutOverride)
{
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
if (tryShortcutOverride && type == QEvent::KeyPress && QWindowSystemInterface::handleShortcutEvent(window,
timestamp, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count)) {
return true;

View File

@ -295,7 +295,7 @@ QString OsTypeTerm::hostOs()
return QStringLiteral("win");
#elif defined(Q_OS_LINUX)
return QStringLiteral("linux");
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
return QStringLiteral("macosx");
#elif defined(Q_OS_ANDROID)
return QStringLiteral("android");

View File

@ -1892,7 +1892,7 @@ void QNetworkAccessManagerPrivate::proxyAuthenticationRequired(const QUrl &url,
}
}
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
//now we try to get the username and password from keychain
//if not successful signal will be emitted
QString username;

View File

@ -66,7 +66,7 @@
#include <QtCore/private/qcore_mac_p.h>
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <CoreServices/CoreServices.h>
#endif

View File

@ -57,14 +57,14 @@
#include <QtCore/qdebug.h>
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
# include <Security/Security.h>
#endif
QT_BEGIN_NAMESPACE
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
namespace {
bool hasTrustedSslServerPolicy(SecPolicyRef policy, CFDictionaryRef props) {
@ -119,7 +119,7 @@ bool isCaCertificateTrusted(SecCertificateRef cfCert, int domain)
}
} // anon namespace
#endif // Q_OS_OSX
#endif // Q_OS_MACOS
QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
{
@ -127,7 +127,7 @@ QList<QSslCertificate> QSslSocketPrivate::systemCaCertificates()
QList<QSslCertificate> systemCerts;
// SecTrustSettingsCopyCertificates is not defined on iOS.
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// iterate through all enum members, order:
// kSecTrustSettingsDomainUser, kSecTrustSettingsDomainAdmin, kSecTrustSettingsDomainSystem
for (int dom = kSecTrustSettingsDomainUser; dom <= int(kSecTrustSettingsDomainSystem); dom++) {

View File

@ -42,7 +42,7 @@
#include <QtCore/qsystemdetection.h>
#include <QtGui/qimage.h>
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
#import <AppKit/AppKit.h>
#else
#include <MobileCoreServices/MobileCoreServices.h>

View File

@ -41,7 +41,7 @@
#include <sys/param.h>
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
#import <AppKit/AppKit.h>
#import <IOKit/graphics/IOGraphicsLib.h>
#elif defined(QT_PLATFORM_UIKIT)

View File

@ -55,7 +55,7 @@
#include <private/qcore_mac_p.h>
#include <QtCore/qloggingcategory.h>
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <ApplicationServices/ApplicationServices.h>
#else
#include <CoreText/CoreText.h>

View File

@ -102,7 +102,7 @@ static QSet<QByteArray> keywords()
#ifdef Q_OS_LINUX
<< "linux"
#endif
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
<< "osx"
<< "macos"
#endif

View File

@ -231,7 +231,7 @@ static void stackTrace()
if (system(cmd) == -1)
fprintf(stderr, "calling gdb failed\n");
fprintf(stderr, "=== End of stack trace ===\n");
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
char cmd[512];
qsnprintf(cmd, 512, "lldb -p %d 2>/dev/null <<EOF\n"
"bt all\n"

View File

@ -189,7 +189,7 @@ private:
// Prevent XCTestProbe from re-launching runTests on application startup
[[NSNotificationCenter defaultCenter] removeObserver:[XCTestProbe class]
name:[NSString stringWithFormat:@"%@DidFinishLaunchingNotification",
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
@"NSApplication"
#else
@"UIApplication"

View File

@ -1041,7 +1041,7 @@ static inline bool isCaseSensitiveFileSystem(const QString &path)
// Return case insensitive unconditionally, even if someone has a case sensitive
// file system mounted, wrongly capitalized drive letters will cause mismatches.
return false;
#elif defined(Q_OS_OSX)
#elif defined(Q_OS_MACOS)
return pathconf(QFile::encodeName(path).constData(), _PC_CASE_SENSITIVE);
#else
return true;

View File

@ -2461,7 +2461,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
}
#endif
break;
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
case Qt::Key_Enter:
case Qt::Key_Return:
// Propagate the enter if you couldn't edit the item and there are no
@ -2493,7 +2493,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event)
break;
}
#endif
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (event->key() == Qt::Key_O && event->modifiers() & Qt::ControlModifier && currentIndex().isValid()) {
emit activated(currentIndex());
break;

View File

@ -4293,7 +4293,7 @@ bool QApplicationPrivate::translateRawTouchEvent(QWidget *window,
QWidget *targetWidget = static_cast<QWidget *>(target.data());
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Single-touch events are normally not sent unless WA_TouchPadAcceptSingleTouchEvents is set.
// In Qt 4 this check was in OS X-only code. That behavior is preserved here by the #ifdef.
if (touchPoints.count() == 1

View File

@ -51,7 +51,7 @@
#include "qgesture.h"
#include "qevent.h"
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include "qmacgesturerecognizer_p.h"
#endif
@ -64,7 +64,7 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcGestureManager, "qt.widgets.gestures")
#if !defined(Q_OS_OSX)
#if !defined(Q_OS_MACOS)
static inline int panTouchPoints()
{
// Override by environment variable for testing.
@ -89,7 +89,7 @@ QGestureManager::QGestureManager(QObject *parent)
{
qRegisterMetaType<Qt::GestureState>();
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
registerGestureRecognizer(new QMacSwipeGestureRecognizer);
registerGestureRecognizer(new QMacPinchGestureRecognizer);
registerGestureRecognizer(new QMacPanGestureRecognizer);

View File

@ -397,7 +397,7 @@ QPointer<QWidget> qt_last_mouse_receiver = nullptr;
void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
{
#if !defined(Q_OS_OSX) && !defined(Q_OS_IOS) // Cocoa tracks popups
#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups
// Ignore all enter/leave events from QPA if we are not on the first-level context menu.
// This prevents duplicated events on most platforms. Fake events will be delivered in
// QWidgetWindow::handleMouseEvent(QMouseEvent *). Make an exception whether the widget
@ -544,7 +544,7 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
if (receiver != activePopupWidget)
widgetPos = receiver->mapFromGlobal(event->globalPos());
#if !defined(Q_OS_OSX) && !defined(Q_OS_IOS) // Cocoa tracks popups
#if !defined(Q_OS_MACOS) && !defined(Q_OS_IOS) // Cocoa tracks popups
const bool reallyUnderMouse = activePopupWidget->rect().contains(mapped);
const bool underMouse = activePopupWidget->underMouse();
if (underMouse != reallyUnderMouse) {

View File

@ -308,7 +308,7 @@ void QAbstractScrollAreaPrivate::init()
q->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
q->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
layoutChildren();
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
# ifndef QT_NO_GESTURES
viewport->grabGesture(Qt::PanGesture);
# endif

View File

@ -1082,7 +1082,7 @@ QComboBox::QComboBox(QComboBoxPrivate &dd, QWidget *parent)
void QComboBoxPrivate::init()
{
Q_Q(QComboBox);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// On OS X, only line edits and list views always get tab focus. It's only
// when we enable full keyboard access that other controls can get tab focus.
// When it's not editable, a combobox looks like a button, and it behaves as
@ -1239,7 +1239,7 @@ void QComboBoxPrivate::updateViewContainerPaletteAndOpacity()
void QComboBoxPrivate::updateFocusPolicy()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
Q_Q(QComboBox);
// See comment in QComboBoxPrivate::init()
@ -2696,7 +2696,7 @@ bool QComboBoxPrivate::showNativePopup()
const QRect targetRect = QRect(tlw->mapFromGlobal(q->mapToGlobal(offset)), QSize());
m_platformMenu->showPopup(tlw, QHighDpi::toNativePixels(targetRect, tlw), currentItem);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// The Cocoa popup will swallow any mouse release event.
// We need to fake one here to un-press the button.
QMouseEvent mouseReleased(QEvent::MouseButtonRelease, q->pos(), Qt::LeftButton,

View File

@ -67,7 +67,7 @@
#include "qtoolbar_p.h"
#endif
#include "qwidgetanimator_p.h"
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@ -79,7 +79,7 @@ class QMainWindowPrivate : public QWidgetPrivate
public:
inline QMainWindowPrivate()
: layout(nullptr), explicitIconSize(false), toolButtonStyle(Qt::ToolButtonIconOnly)
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
, useUnifiedToolBar(false)
#endif
{ }
@ -87,7 +87,7 @@ public:
QSize iconSize;
bool explicitIconSize;
Qt::ToolButtonStyle toolButtonStyle;
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
bool useUnifiedToolBar;
#endif
void init();
@ -1357,7 +1357,7 @@ bool QMainWindow::event(QEvent *event)
*/
void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
Q_D(QMainWindow);
if (isWindow()) {
d->useUnifiedToolBar = set;
@ -1382,7 +1382,7 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set)
bool QMainWindow::unifiedTitleAndToolBarOnMac() const
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
return d_func()->useUnifiedToolBar;
#endif
return false;

View File

@ -48,7 +48,7 @@
#include "qlayout.h"
#include "qpainter.h"
#include <qpa/qplatformtheme.h>
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include "qmacnativewidget_mac.h"
#endif
#include "qapplication.h"
@ -1491,7 +1491,7 @@ void QMenuPrivate::_q_platformMenuAboutToShow()
emit q->aboutToShow();
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (platformMenu) {
const auto actions = q->actions();
for (QAction *action : actions) {
@ -3547,7 +3547,7 @@ void QMenu::actionEvent(QActionEvent *e)
d->currentAction = nullptr;
if (QWidgetAction *wa = qobject_cast<QWidgetAction *>(e->action())) {
if (QWidget *widget = d->widgetItems.value(wa)) {
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QWidget *p = widget->parentWidget();
if (p != this && qobject_cast<QMacNativeWidget *>(p)) {
// This widget was reparented into a native Mac view

View File

@ -270,7 +270,7 @@ private:
friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action);
};
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// ### Qt 4 compatibility; remove in Qt 6
inline QT_DEPRECATED void qt_mac_set_dock_menu(QMenu *menu) { menu->setAsDockMenu(); }
#endif

View File

@ -335,7 +335,7 @@ public:
void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem *item);
QPlatformMenuItem *insertActionInPlatformMenu(const QAction *action, QPlatformMenuItem *beforeItem);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
void moveWidgetToPlatformItem(QWidget *w, QPlatformMenuItem* item);
#endif

View File

@ -60,7 +60,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@ -115,7 +115,7 @@ inline static bool verticalTabs(QTabBar::Shape shape)
void QTabBarPrivate::updateMacBorderMetrics()
{
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
Q_Q(QTabBar);
// Extend the unified title and toolbar area to cover the tab bar iff
// 1) the tab bar is in document mode

View File

@ -61,7 +61,7 @@
#include <private/qwidgetaction_p.h>
#include <private/qmainwindowlayout_p.h>
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@ -248,7 +248,7 @@ bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
QStyleOptionToolBar opt;
q->initStyleOption(&opt);
if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) {
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// When using the unified toolbar on OS X, the user can click and
// drag between toolbar contents to move the window. Make this work by
// implementing the standard mouse-dragging code and then call
@ -282,7 +282,7 @@ bool QToolBarPrivate::mouseReleaseEvent(QMouseEvent*)
endDrag();
return true;
} else {
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (!macWindowDragging)
return false;
macWindowDragging = false;
@ -298,7 +298,7 @@ bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
Q_Q(QToolBar);
if (!state) {
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (!macWindowDragging)
return false;
QWidget *w = q->window();
@ -1083,7 +1083,7 @@ static bool waitForPopup(QToolBar *tb, QWidget *popup)
return false;
}
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
static void enableMacToolBar(QToolBar *toolbar, bool enable)
{
QPlatformNativeInterface *nativeInterface = QApplication::platformNativeInterface();
@ -1122,7 +1122,7 @@ bool QToolBar::event(QEvent *event)
Q_FALLTHROUGH();
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
enableMacToolBar(this, event->type() == QEvent::Show);
#endif
emit visibilityChanged(event->type() == QEvent::Show);

View File

@ -74,7 +74,7 @@ public:
allowedAreas(Qt::AllToolBarAreas), orientation(Qt::Horizontal),
toolButtonStyle(Qt::ToolButtonIconOnly),
layout(nullptr), state(nullptr)
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
, macWindowDragging(false)
#endif
{ }
@ -106,7 +106,7 @@ public:
};
DragState *state;
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
bool macWindowDragging;
QPoint macWindowDragPressPosition;
#endif

View File

@ -48,7 +48,7 @@
#include <qmenu.h>
#include <qdebug.h>
#include <qmath.h>
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <qpa/qplatformnativeinterface.h>
#endif
@ -348,7 +348,7 @@ static bool defaultWidgetAction(QToolBarItem *item)
void QToolBarLayout::updateMacBorderMetrics()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QToolBar *tb = qobject_cast<QToolBar*>(parentWidget());
if (!tb)
return;

View File

@ -289,10 +289,10 @@ void tst_QClipboard::copyImage()
image.fill(QColor(Qt::transparent));
image.setPixel(QPoint(1, 0), QColor(Qt::blue).rgba());
QGuiApplication::clipboard()->setImage(image);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// The Pasteboard needs a moment to breathe (at least on older Macs).
QTest::qWait(100);
#endif // Q_OS_OSX
#endif // Q_OS_MACOS
// paster will perform hard-coded checks on the copied image.
QByteArray errorMessage;
QVERIFY2(runHelper(QStringLiteral("paster/paster"),

View File

@ -607,7 +607,7 @@ void tst_QDialog::snapToDefaultButton()
+ QPoint(100, 100), QSize(200, 200));
const QPoint startingPos = dialogGeometry.bottomRight() + QPoint(100, 100);
QCursor::setPos(startingPos);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// On OS X we use CGEventPost to move the cursor, it needs at least
// some time before the event handled and the position really set.
QTest::qWait(100);

View File

@ -75,7 +75,7 @@
#include <qtimer.h>
#include <QtWidgets/QDoubleSpinBox>
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
#include "tst_qwidget_mac_helpers.h" // Abstract the ObjC stuff out so not everyone must run an ObjC++ compile.
#endif
@ -110,7 +110,7 @@ static HWND winHandleOf(const QWidget *w)
# define Q_CHECK_PAINTEVENTS
#endif
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
#include <Security/AuthSession.h>
bool macHasAccessToWindowsServer()
{
@ -216,7 +216,7 @@ private slots:
void restoreVersion1Geometry();
void widgetAt();
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
void setMask();
#endif
void optimizedResizeMove();
@ -250,7 +250,7 @@ private slots:
void update();
void isOpaque();
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
void scroll();
void scrollNativeChildren();
#endif
@ -381,7 +381,7 @@ private slots:
void taskQTBUG_7532_tabOrderWithFocusProxy();
void movedAndResizedAttributes();
void childAt();
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
void taskQTBUG_11373();
#endif
void taskQTBUG_17333_ResizeInfiniteRecursion();
@ -2301,7 +2301,7 @@ void tst_QWidget::activation()
void tst_QWidget::windowState()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
@ -2514,7 +2514,7 @@ void tst_QWidget::showMaximized()
void tst_QWidget::showFullScreen()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
@ -2834,14 +2834,14 @@ void tst_QWidget::showMinimizedKeepsFocus()
window.showNormal();
QApplication::setActiveWindow(&window);
QVERIFY(QTest::qWaitForWindowActive(&window));
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (!macHasAccessToWindowsServer())
QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue);
#elif defined(Q_OS_WINRT)
QEXPECT_FAIL("", "Winrt fails here - QTBUG-68297", Continue);
#endif
QTRY_COMPARE(window.focusWidget(), firstchild);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (!macHasAccessToWindowsServer())
QEXPECT_FAIL("", "When not having WindowServer access, we lose focus.", Continue);
#elif defined(Q_OS_WINRT)
@ -2904,7 +2904,7 @@ void tst_QWidget::reparent()
// Qt/Embedded does it differently.
void tst_QWidget::icon()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
@ -2970,7 +2970,7 @@ void tst_QWidget::hideWhenFocusWidgetIsChild()
void tst_QWidget::normalGeometry()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
@ -3230,7 +3230,7 @@ public:
void tst_QWidget::lostUpdatesOnHide()
{
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
UpdateWidget widget;
widget.setAttribute(Qt::WA_DontShowOnScreen);
widget.setWindowTitle(QLatin1String(QTest::currentTestFunction()));
@ -3271,7 +3271,7 @@ void tst_QWidget::raise()
parentPtr->show();
QVERIFY(QTest::qWaitForWindowExposed(parentPtr.data()));
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (child1->internalWinId()) {
QSKIP("Cocoa has no Z-Order for views, we hack it, but it results in paint events.");
}
@ -3412,7 +3412,7 @@ void tst_QWidget::lower()
void tst_QWidget::stackUnder()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974: Cocoa has no Z-Order for views, we hack it, but it results in paint events.");
#endif
@ -3445,7 +3445,7 @@ void tst_QWidget::stackUnder()
for (UpdateWidget *child : qAsConst(allChildren)) {
int expectedPaintEvents = child == child4 ? 1 : 0;
#if defined(Q_OS_WIN) || defined(Q_OS_OSX)
#if defined(Q_OS_WIN) || defined(Q_OS_MACOS)
if (expectedPaintEvents == 1 && child->numPaintEvents == 2)
QEXPECT_FAIL(0, "Mac and Windows issues double repaints for Z-Order change", Continue);
#endif
@ -3479,7 +3479,7 @@ void tst_QWidget::stackUnder()
for (UpdateWidget *child : qAsConst(allChildren)) {
int expectedZOrderChangeEvents = child == child1 ? 1 : 0;
if (child == child3) {
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
QEXPECT_FAIL(0, "See QTBUG-493", Continue);
#endif
QCOMPARE(child->numPaintEvents, 0);
@ -3579,7 +3579,7 @@ void tst_QWidget::testContentsPropagation()
void tst_QWidget::saveRestoreGeometry()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
@ -3817,7 +3817,7 @@ void tst_QWidget::restoreVersion1Geometry()
void tst_QWidget::widgetAt()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
@ -4020,7 +4020,7 @@ void tst_QWidget::testDeletionInEventHandlers()
delete w;
}
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
class MaskedPainter : public QWidget
{
public:
@ -4887,7 +4887,7 @@ void tst_QWidget::update()
QCOMPARE(sibling.numPaintEvents, 1);
QCOMPARE(sibling.paintedRegion, sibling.visibleRegion());
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
if (child.internalWinId()) // child is native
QEXPECT_FAIL(0, "Cocoa compositor paints child and sibling", Continue);
#endif
@ -4904,7 +4904,7 @@ void tst_QWidget::update()
}
}
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
static inline bool isOpaque(QWidget *widget)
{
if (!widget)
@ -4915,7 +4915,7 @@ static inline bool isOpaque(QWidget *widget)
void tst_QWidget::isOpaque()
{
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
QWidget w;
QVERIFY(::isOpaque(&w));
@ -4987,7 +4987,7 @@ void tst_QWidget::isOpaque()
#endif
}
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
/*
Test that scrolling of a widget invalidates the correct regions
*/
@ -5431,7 +5431,7 @@ void tst_QWidget::windowMoveResize()
widget.move(r.topLeft());
widget.resize(r.size());
QApplication::processEvents();
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
if (r.width() == 0 && r.height() > 0) {
widget.move(r.topLeft());
widget.resize(r.size());
@ -5502,7 +5502,7 @@ void tst_QWidget::windowMoveResize()
widget.move(r.topLeft());
widget.resize(r.size());
QApplication::processEvents();
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
if (r.width() == 0 && r.height() > 0) {
widget.move(r.topLeft());
widget.resize(r.size());
@ -5689,7 +5689,7 @@ void tst_QWidget::moveChild()
QTRY_COMPARE(pos, child.pos());
QTRY_COMPARE(parent.r, QRegion(oldGeometry) - child.geometry());
#if !defined(Q_OS_OSX)
#if !defined(Q_OS_MACOS)
// should be scrolled in backingstore
QCOMPARE(child.r, QRegion());
#endif
@ -5739,7 +5739,7 @@ void tst_QWidget::showAndMoveChild()
void tst_QWidget::subtractOpaqueSiblings()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974: Cocoa only has rect granularity.");
#endif
@ -5816,7 +5816,7 @@ public slots:
void tst_QWidget::multipleToplevelFocusCheck()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
@ -7584,7 +7584,7 @@ void tst_QWidget::render_systemClip()
// rrrrrrrrrr
// ...
#ifndef Q_OS_OSX
#ifndef Q_OS_MACOS
for (int i = 0; i < image.height(); ++i) {
for (int j = 0; j < image.width(); ++j) {
if (i < 50 && j < i)
@ -8618,11 +8618,11 @@ void tst_QWidget::sendUpdateRequestImmediately()
void tst_QWidget::doubleRepaint()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974");
#endif
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
if (!macHasAccessToWindowsServer())
QSKIP("Not having window server access causes the wrong number of repaints to be issues");
#endif
@ -9330,7 +9330,7 @@ void tst_QWidget::setClearAndResizeMask()
child.setMask(childMask);
QTRY_COMPARE(child.mask(), childMask);
// and ensure that the child widget doesn't get any update.
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
if (child.internalWinId())
QCOMPARE(child.numPaintEvents, 1);
@ -9352,7 +9352,7 @@ void tst_QWidget::setClearAndResizeMask()
// and ensure that that the child widget gets an update for the area outside the old mask.
QTRY_COMPARE(child.numPaintEvents, 1);
outsideOldMask = child.rect();
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
if (!child.internalWinId())
#endif
@ -9366,7 +9366,7 @@ void tst_QWidget::setClearAndResizeMask()
// Mask child widget with a mask that is bigger than the rect
child.setMask(QRegion(0, 0, 1000, 1000));
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
if (child.internalWinId())
QTRY_COMPARE(child.numPaintEvents, 1);
@ -9379,7 +9379,7 @@ void tst_QWidget::setClearAndResizeMask()
// ...and the same applies when clearing the mask.
child.clearMask();
QTest::qWait(100);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
if (child.internalWinId())
QTRY_VERIFY(child.numPaintEvents > 0);
@ -9409,7 +9409,7 @@ void tst_QWidget::setClearAndResizeMask()
QTimer::singleShot(100, &resizeChild, SLOT(shrinkMask()));
QTest::qWait(200);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
if (child.internalWinId())
QTRY_COMPARE(resizeChild.paintedRegion, resizeChild.mask());
@ -9421,7 +9421,7 @@ void tst_QWidget::setClearAndResizeMask()
const QRegion oldMask = resizeChild.mask();
QTimer::singleShot(0, &resizeChild, SLOT(enlargeMask()));
QTest::qWait(100);
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
// Mac always issues a full update when calling setMask, and we cannot force it to not do so.
if (child.internalWinId())
QTRY_COMPARE(resizeChild.paintedRegion, resizeChild.mask());
@ -10265,7 +10265,7 @@ void tst_QWidget::childAt()
QCOMPARE(parent.childAt(120, 120), grandChild);
}
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
void tst_QWidget::taskQTBUG_11373()
{
@ -11121,7 +11121,7 @@ public:
// when mousing over it.
void tst_QWidget::taskQTBUG_27643_enterEvents()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QTBUG-52974: this test can crash!");
#endif
// Move the mouse cursor to a safe location so it won't interfere

View File

@ -995,7 +995,7 @@ void tst_QStyleSheetStyle::focusColors()
#ifndef QT_NO_CURSOR
void tst_QStyleSheetStyle::hoverColors()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("This test is fragile on Mac, most likely due to QTBUG-33959.");
#endif
if (QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive))

View File

@ -1525,7 +1525,7 @@ void tst_QMenuBar::cornerWidgets()
QFETCH(Qt::Corner, corner);
#if defined(Q_OS_OSX)
#if defined(Q_OS_MACOS)
QSKIP("Test interferes with native menu bars on this platform");
#endif

View File

@ -579,7 +579,7 @@ bool verifyColor(const QWidget *widget, const QRect &clipArea, const QColor &col
void tst_QOpenGLWidget::stackWidgetOpaqueChildIsVisible()
{
#ifdef Q_OS_OSX
#ifdef Q_OS_MACOS
QSKIP("QScreen::grabWindow() doesn't work properly on OSX HighDPI screen: QTBUG-46803");
return;
#endif