Cocoa QPA: Clean up 0 as pointer
We use nil for Objective-C null pointers and nullptr everywhere else, including CoreFoundation and similar opaque types. Change-Id: Id75c59413dec54bf4d8e83cf7ed0ff7f3d8bb480 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
48defe41e1
commit
7ee44dcb9c
@ -60,7 +60,7 @@ QPlatformIntegration * QCocoaIntegrationPlugin::create(const QString& system, co
|
||||
if (system.compare(QLatin1String("cocoa"), Qt::CaseInsensitive) == 0)
|
||||
return new QCocoaIntegration(paramList);
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -311,7 +311,7 @@ NSString *getTranslatedAction(const QString &qtAction)
|
||||
// NSAccessibilityCancelAction;
|
||||
// NSAccessibilityDeleteAction;
|
||||
|
||||
return 0;
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
|
@ -569,7 +569,7 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
||||
return NSAccessibilityUnignoredAncestor(self);
|
||||
|
||||
// find the deepest child at the point
|
||||
QAccessibleInterface *childOfChildInterface = 0;
|
||||
QAccessibleInterface *childOfChildInterface = nullptr;
|
||||
do {
|
||||
childOfChildInterface = childInterface->childAt(screenPoint.x(), screenPoint.y());
|
||||
if (childOfChildInterface && childOfChildInterface->isValid())
|
||||
|
@ -113,7 +113,7 @@ static const QByteArray q_macLocalEventType = QByteArrayLiteral("mac_generic_NSE
|
||||
static bool qt_filterEvent(NSEvent *event)
|
||||
{
|
||||
if (qApp && qApp->eventDispatcher()->
|
||||
filterNativeEvent(q_macLocalEventType, static_cast<void*>(event), 0))
|
||||
filterNativeEvent(q_macLocalEventType, static_cast<void*>(event), nullptr))
|
||||
return true;
|
||||
|
||||
if ([event type] == NSApplicationDefined) {
|
||||
|
@ -56,13 +56,13 @@ QMimeData *QCocoaClipboard::mimeData(QClipboard::Mode mode)
|
||||
pasteBoard->sync();
|
||||
return pasteBoard->mimeData();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QCocoaClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode)
|
||||
{
|
||||
if (QMacPasteboard *pasteBoard = pasteboardForMode(mode)) {
|
||||
if (data == 0) {
|
||||
if (!data) {
|
||||
pasteBoard->clear();
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ QMacPasteboard *QCocoaClipboard::pasteboardForMode(QClipboard::Mode mode) const
|
||||
else if (mode == QClipboard::FindBuffer)
|
||||
return m_find.data();
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void QCocoaClipboard::handleApplicationStateChanged(Qt::ApplicationState state)
|
||||
|
@ -74,8 +74,8 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
|
||||
{
|
||||
self = [super init];
|
||||
mColorPanel = [NSColorPanel sharedColorPanel];
|
||||
mHelper = 0;
|
||||
mStolenContentView = 0;
|
||||
mHelper = nullptr;
|
||||
mStolenContentView = nil;
|
||||
mPanelButtons = nil;
|
||||
mResultCode = NSModalResponseCancel;
|
||||
mDialogIsExecuting = false;
|
||||
@ -115,9 +115,9 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate);
|
||||
[self restoreOriginalContentView];
|
||||
} else if (!mStolenContentView) {
|
||||
// steal the color panel's contents view
|
||||
mStolenContentView = [mColorPanel contentView];
|
||||
mStolenContentView = mColorPanel.contentView;
|
||||
[mStolenContentView retain];
|
||||
[mColorPanel setContentView:0];
|
||||
mColorPanel.contentView = nil;
|
||||
|
||||
// create a new content view and add the stolen one as a subview
|
||||
mPanelButtons = [[QNSPanelContentsWrapper alloc] initWithPanelDelegate:self];
|
||||
@ -309,7 +309,7 @@ public:
|
||||
void cleanup(QCocoaColorDialogHelper *helper)
|
||||
{
|
||||
if (mDelegate->mHelper == helper)
|
||||
mDelegate->mHelper = 0;
|
||||
mDelegate->mHelper = nullptr;
|
||||
}
|
||||
|
||||
bool exec()
|
||||
|
@ -80,15 +80,15 @@ void QCocoaCursor::setPos(const QPoint &position)
|
||||
pos.x = position.x();
|
||||
pos.y = position.y();
|
||||
|
||||
CGEventRef e = CGEventCreateMouseEvent(0, kCGEventMouseMoved, pos, kCGMouseButtonLeft);
|
||||
CGEventRef e = CGEventCreateMouseEvent(nullptr, kCGEventMouseMoved, pos, kCGMouseButtonLeft);
|
||||
CGEventPost(kCGHIDEventTap, e);
|
||||
CFRelease(e);
|
||||
}
|
||||
|
||||
NSCursor *QCocoaCursor::convertCursor(QCursor *cursor)
|
||||
{
|
||||
if (cursor == nullptr)
|
||||
return 0;
|
||||
if (!cursor)
|
||||
return nil;
|
||||
|
||||
const Qt::CursorShape newShape = cursor->shape();
|
||||
NSCursor *cocoaCursor;
|
||||
@ -138,11 +138,11 @@ NSCursor *QCocoaCursor::convertCursor(QCursor *cursor)
|
||||
cocoaCursor = m_cursors.value(newShape);
|
||||
if (cocoaCursor && cursor->shape() == Qt::BitmapCursor) {
|
||||
[cocoaCursor release];
|
||||
cocoaCursor = 0;
|
||||
cocoaCursor = nil;
|
||||
}
|
||||
if (cocoaCursor == 0) {
|
||||
if (!cocoaCursor) {
|
||||
cocoaCursor = createCursorData(cursor);
|
||||
if (cocoaCursor == 0)
|
||||
if (!cocoaCursor)
|
||||
return [NSCursor arrowCursor];
|
||||
|
||||
m_cursors.insert(newShape, cocoaCursor);
|
||||
@ -211,8 +211,8 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor)
|
||||
0x07, 0xf0, 0x0f, 0xf8, 0x0f, 0xf8, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0,
|
||||
0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0, 0x01, 0xc0 };
|
||||
#endif
|
||||
const uchar *cursorData = 0;
|
||||
const uchar *cursorMaskData = 0;
|
||||
const uchar *cursorData = nullptr;
|
||||
const uchar *cursorMaskData = nullptr;
|
||||
QPoint hotspot = cursor->hotSpot();
|
||||
|
||||
switch (cursor->shape()) {
|
||||
@ -269,7 +269,7 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor)
|
||||
#endif
|
||||
default:
|
||||
qWarning("Qt: QCursor::update: Invalid cursor shape %d", cursor->shape());
|
||||
return 0;
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Create an NSCursor from image data if this a self-provided cursor.
|
||||
@ -279,7 +279,7 @@ NSCursor *QCocoaCursor::createCursorData(QCursor *cursor)
|
||||
return (createCursorFromBitmap(&bitmap, &mask, hotspot));
|
||||
}
|
||||
|
||||
return 0; // should not happen, all cases covered above
|
||||
return nil; // should not happen, all cases covered above
|
||||
}
|
||||
|
||||
NSCursor *QCocoaCursor::createCursorFromBitmap(const QBitmap *bitmap, const QBitmap *mask, const QPoint hotspot)
|
||||
|
@ -50,10 +50,10 @@ QT_BEGIN_NAMESPACE
|
||||
static const int dragImageMaxChars = 26;
|
||||
|
||||
QCocoaDrag::QCocoaDrag() :
|
||||
m_drag(0)
|
||||
m_drag(nullptr)
|
||||
{
|
||||
m_lastEvent = 0;
|
||||
m_lastView = 0;
|
||||
m_lastEvent = nil;
|
||||
m_lastView = nil;
|
||||
}
|
||||
|
||||
QCocoaDrag::~QCocoaDrag()
|
||||
@ -73,7 +73,7 @@ QMimeData *QCocoaDrag::dragMimeData()
|
||||
if (m_drag)
|
||||
return m_drag->mimeData();
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Qt::DropAction QCocoaDrag::defaultAction(Qt::DropActions possibleActions,
|
||||
@ -140,7 +140,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
|
||||
|
||||
NSPoint event_location = [m_lastEvent locationInWindow];
|
||||
NSWindow *theWindow = [m_lastEvent window];
|
||||
Q_ASSERT(theWindow != nil);
|
||||
Q_ASSERT(theWindow);
|
||||
event_location.x -= hotSpot.x();
|
||||
CGFloat flippedY = pmDeviceIndependentSize.height() - hotSpot.y();
|
||||
event_location.y -= flippedY;
|
||||
@ -157,7 +157,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
|
||||
|
||||
[nsimage release];
|
||||
|
||||
m_drag = 0;
|
||||
m_drag = nullptr;
|
||||
return m_executed_drop_action;
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,8 @@ class QCocoaEventDispatcher : public QAbstractEventDispatcher
|
||||
Q_DECLARE_PRIVATE(QCocoaEventDispatcher)
|
||||
|
||||
public:
|
||||
QCocoaEventDispatcher(QAbstractEventDispatcherPrivate &priv, QObject *parent = 0);
|
||||
explicit QCocoaEventDispatcher(QObject *parent = 0);
|
||||
QCocoaEventDispatcher(QAbstractEventDispatcherPrivate &priv, QObject *parent = nullptr);
|
||||
explicit QCocoaEventDispatcher(QObject *parent = nullptr);
|
||||
~QCocoaEventDispatcher();
|
||||
|
||||
bool processEvents(QEventLoop::ProcessEventsFlags flags);
|
||||
|
@ -129,11 +129,11 @@ void QCocoaEventDispatcherPrivate::maybeStartCFRunLoopTimer()
|
||||
{
|
||||
if (timerInfoList.isEmpty()) {
|
||||
// no active timers, so the CFRunLoopTimerRef should not be active either
|
||||
Q_ASSERT(runLoopTimerRef == 0);
|
||||
Q_ASSERT(!runLoopTimerRef);
|
||||
return;
|
||||
}
|
||||
|
||||
if (runLoopTimerRef == 0) {
|
||||
if (!runLoopTimerRef) {
|
||||
// start the CFRunLoopTimer
|
||||
CFAbsoluteTime ttf = CFAbsoluteTimeGetCurrent();
|
||||
CFTimeInterval interval;
|
||||
@ -150,11 +150,11 @@ void QCocoaEventDispatcherPrivate::maybeStartCFRunLoopTimer()
|
||||
}
|
||||
|
||||
ttf += interval;
|
||||
CFRunLoopTimerContext info = { 0, this, 0, 0, 0 };
|
||||
CFRunLoopTimerContext info = { 0, this, nullptr, nullptr, nullptr };
|
||||
// create the timer with a large interval, as recommended by the CFRunLoopTimerSetNextFireDate()
|
||||
// documentation, since we will adjust the timer's time-to-fire as needed to keep Qt timers working
|
||||
runLoopTimerRef = CFRunLoopTimerCreate(0, ttf, oneyear, 0, 0, QCocoaEventDispatcherPrivate::runLoopTimerCallback, &info);
|
||||
Q_ASSERT(runLoopTimerRef != 0);
|
||||
runLoopTimerRef = CFRunLoopTimerCreate(nullptr, ttf, oneyear, 0, 0, QCocoaEventDispatcherPrivate::runLoopTimerCallback, &info);
|
||||
Q_ASSERT(runLoopTimerRef);
|
||||
|
||||
CFRunLoopAddTimer(mainRunLoop(), runLoopTimerRef, kCFRunLoopCommonModes);
|
||||
} else {
|
||||
@ -180,12 +180,12 @@ void QCocoaEventDispatcherPrivate::maybeStartCFRunLoopTimer()
|
||||
|
||||
void QCocoaEventDispatcherPrivate::maybeStopCFRunLoopTimer()
|
||||
{
|
||||
if (runLoopTimerRef == 0)
|
||||
if (!runLoopTimerRef)
|
||||
return;
|
||||
|
||||
CFRunLoopTimerInvalidate(runLoopTimerRef);
|
||||
CFRelease(runLoopTimerRef);
|
||||
runLoopTimerRef = 0;
|
||||
runLoopTimerRef = nullptr;
|
||||
}
|
||||
|
||||
void QCocoaEventDispatcher::registerTimer(int timerId, int interval, Qt::TimerType timerType, QObject *obj)
|
||||
@ -368,13 +368,13 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
break;
|
||||
|
||||
QMacAutoReleasePool pool;
|
||||
NSEvent* event = 0;
|
||||
NSEvent* event = nil;
|
||||
|
||||
// First, send all previously excluded input events, if any:
|
||||
if (!excludeUserEvents) {
|
||||
while (!d->queuedUserInputEvents.isEmpty()) {
|
||||
event = static_cast<NSEvent *>(d->queuedUserInputEvents.takeFirst());
|
||||
if (!filterNativeEvent("NSEvent", event, 0)) {
|
||||
if (!filterNativeEvent("NSEvent", event, nullptr)) {
|
||||
[NSApp sendEvent:event];
|
||||
retVal = true;
|
||||
}
|
||||
@ -432,7 +432,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
retVal = true;
|
||||
} else {
|
||||
int lastSerialCopy = d->lastSerial;
|
||||
bool hadModalSession = d->currentModalSessionCached != 0;
|
||||
const bool hadModalSession = d->currentModalSessionCached;
|
||||
// We cannot block the thread (and run in a tight loop).
|
||||
// Instead we will process all current pending events and return.
|
||||
d->ensureNSAppInitialized();
|
||||
@ -471,12 +471,12 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
d->queuedUserInputEvents.append(event);
|
||||
continue;
|
||||
}
|
||||
if (!filterNativeEvent("NSEvent", event, 0)) {
|
||||
if (!filterNativeEvent("NSEvent", event, nullptr)) {
|
||||
[NSApp sendEvent:event];
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
} while (!d->interrupt && event != nil);
|
||||
} while (!d->interrupt && event);
|
||||
} else do {
|
||||
// INVARIANT: No modal window is executing.
|
||||
event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
||||
@ -492,12 +492,12 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!filterNativeEvent("NSEvent", event, 0)) {
|
||||
if (!filterNativeEvent("NSEvent", event, nullptr)) {
|
||||
[NSApp sendEvent:event];
|
||||
retVal = true;
|
||||
}
|
||||
}
|
||||
} while (!d->interrupt && event != nil);
|
||||
} while (!d->interrupt && event);
|
||||
|
||||
if ((d->processEventsFlags & QEventLoop::EventLoopExec) == 0) {
|
||||
// when called "manually", always send posted events and timers
|
||||
@ -514,7 +514,7 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
|
||||
// event recursion to ensure that we spin the correct modal session.
|
||||
// We do the interruptLater at the end of the function to ensure that we don't
|
||||
// disturb the 'wait for more events' below (as deleteLater will post an event):
|
||||
if (hadModalSession && d->currentModalSessionCached == 0)
|
||||
if (hadModalSession && !d->currentModalSessionCached)
|
||||
interruptLater = true;
|
||||
}
|
||||
bool canWait = (d->threadData->canWait
|
||||
@ -611,11 +611,11 @@ void QCocoaEventDispatcherPrivate::temporarilyStopAllModalSessions()
|
||||
QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
|
||||
if (info.session) {
|
||||
[NSApp endModalSession:info.session];
|
||||
info.session = 0;
|
||||
info.session = nullptr;
|
||||
[(NSWindow*) info.nswindow release];
|
||||
}
|
||||
}
|
||||
currentModalSessionCached = 0;
|
||||
currentModalSessionCached = nullptr;
|
||||
}
|
||||
|
||||
NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
|
||||
@ -626,7 +626,7 @@ NSModalSession QCocoaEventDispatcherPrivate::currentModalSession()
|
||||
return currentModalSessionCached;
|
||||
|
||||
if (cocoaModalSessionStack.isEmpty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
int sessionCount = cocoaModalSessionStack.size();
|
||||
for (int i=0; i<sessionCount; ++i) {
|
||||
@ -728,9 +728,9 @@ void QCocoaEventDispatcherPrivate::cleanupModalSessions()
|
||||
currentModalSessionCached = info.session;
|
||||
break;
|
||||
}
|
||||
currentModalSessionCached = 0;
|
||||
currentModalSessionCached = nullptr;
|
||||
if (info.session) {
|
||||
Q_ASSERT(info.nswindow != 0);
|
||||
Q_ASSERT(info.nswindow);
|
||||
[NSApp endModalSession:info.session];
|
||||
[(NSWindow *)info.nswindow release];
|
||||
}
|
||||
@ -757,10 +757,10 @@ void QCocoaEventDispatcherPrivate::beginModalSession(QWindow *window)
|
||||
// currentModalSession). A QCocoaModalSessionInfo is considered pending to be stopped if
|
||||
// the window pointer is zero, and the session pointer is non-zero (it will be fully
|
||||
// stopped in cleanupModalSessions()).
|
||||
QCocoaModalSessionInfo info = {window, 0, 0};
|
||||
QCocoaModalSessionInfo info = {window, nullptr, nullptr};
|
||||
cocoaModalSessionStack.push(info);
|
||||
updateChildrenWorksWhenModal();
|
||||
currentModalSessionCached = 0;
|
||||
currentModalSessionCached = nullptr;
|
||||
}
|
||||
|
||||
void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
|
||||
@ -779,12 +779,12 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
|
||||
if (!info.window)
|
||||
endedSessions++;
|
||||
if (info.window == window) {
|
||||
info.window = 0;
|
||||
info.window = nullptr;
|
||||
if (i + endedSessions == stackSize-1) {
|
||||
// The top sessions ended. Interrupt the event dispatcher to
|
||||
// start spinning the correct session immediately.
|
||||
q->interrupt();
|
||||
currentModalSessionCached = 0;
|
||||
currentModalSessionCached = nullptr;
|
||||
cleanupModalSessionsNeeded = true;
|
||||
}
|
||||
}
|
||||
@ -793,13 +793,13 @@ void QCocoaEventDispatcherPrivate::endModalSession(QWindow *window)
|
||||
|
||||
QCocoaEventDispatcherPrivate::QCocoaEventDispatcherPrivate()
|
||||
: processEventsFlags(0),
|
||||
runLoopTimerRef(0),
|
||||
runLoopTimerRef(nullptr),
|
||||
blockSendPostedEvents(false),
|
||||
currentExecIsNSAppRun(false),
|
||||
nsAppRunCalledByQt(false),
|
||||
cleanupModalSessionsNeeded(false),
|
||||
processEventsCalled(0),
|
||||
currentModalSessionCached(0),
|
||||
currentModalSessionCached(nullptr),
|
||||
lastSerial(-1),
|
||||
interrupt(false)
|
||||
{
|
||||
@ -937,7 +937,7 @@ void QCocoaEventDispatcherPrivate::cancelWaitForMoreEvents()
|
||||
// events somewhere, we post a dummy event to wake it up:
|
||||
QMacAutoReleasePool pool;
|
||||
[NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
|
||||
modifierFlags:0 timestamp:0. windowNumber:0 context:0
|
||||
modifierFlags:0 timestamp:0. windowNumber:0 context:nil
|
||||
subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
|
||||
}
|
||||
|
||||
@ -1019,7 +1019,7 @@ QCocoaEventDispatcher::~QCocoaEventDispatcher()
|
||||
CFRelease(d->firstTimeObserver);
|
||||
}
|
||||
|
||||
QtCocoaInterruptDispatcher* QtCocoaInterruptDispatcher::instance = 0;
|
||||
QtCocoaInterruptDispatcher* QtCocoaInterruptDispatcher::instance = nullptr;
|
||||
|
||||
QtCocoaInterruptDispatcher::QtCocoaInterruptDispatcher() : cancelled(false)
|
||||
{
|
||||
@ -1036,7 +1036,7 @@ QtCocoaInterruptDispatcher::~QtCocoaInterruptDispatcher()
|
||||
{
|
||||
if (cancelled)
|
||||
return;
|
||||
instance = 0;
|
||||
instance = nullptr;
|
||||
QCocoaEventDispatcher::instance()->interrupt();
|
||||
}
|
||||
|
||||
@ -1046,7 +1046,7 @@ void QtCocoaInterruptDispatcher::cancelInterruptLater()
|
||||
return;
|
||||
instance->cancelled = true;
|
||||
delete instance;
|
||||
instance = 0;
|
||||
instance = nullptr;
|
||||
}
|
||||
|
||||
void QtCocoaInterruptDispatcher::interruptLater()
|
||||
|
@ -129,7 +129,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate);
|
||||
} else {
|
||||
mSavePanel = [NSSavePanel savePanel];
|
||||
[mSavePanel setCanSelectHiddenExtension:YES];
|
||||
mOpenPanel = 0;
|
||||
mOpenPanel = nil;
|
||||
}
|
||||
|
||||
if ([mSavePanel respondsToSelector:@selector(setLevel:)])
|
||||
@ -569,7 +569,7 @@ static QString strippedText(QString s)
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QCocoaFileDialogHelper::QCocoaFileDialogHelper()
|
||||
:mDelegate(0)
|
||||
: mDelegate(nil)
|
||||
{
|
||||
}
|
||||
|
||||
@ -579,7 +579,7 @@ QCocoaFileDialogHelper::~QCocoaFileDialogHelper()
|
||||
return;
|
||||
QMacAutoReleasePool pool;
|
||||
[mDelegate release];
|
||||
mDelegate = 0;
|
||||
mDelegate = nil;
|
||||
}
|
||||
|
||||
void QCocoaFileDialogHelper::QNSOpenSavePanelDelegate_selectionChanged(const QString &newPath)
|
||||
|
@ -100,9 +100,9 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
mFontPanel = [NSFontPanel sharedFontPanel];
|
||||
mHelper = 0;
|
||||
mStolenContentView = 0;
|
||||
mPanelButtons = 0;
|
||||
mHelper = nullptr;
|
||||
mStolenContentView = nil;
|
||||
mPanelButtons = nil;
|
||||
mResultCode = NSModalResponseCancel;
|
||||
mDialogIsExecuting = false;
|
||||
mResultSet = false;
|
||||
@ -136,9 +136,9 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
|
||||
[self restoreOriginalContentView];
|
||||
} else if (!mStolenContentView) {
|
||||
// steal the font panel's contents view
|
||||
mStolenContentView = [mFontPanel contentView];
|
||||
mStolenContentView = mFontPanel.contentView;
|
||||
[mStolenContentView retain];
|
||||
[mFontPanel setContentView:0];
|
||||
mFontPanel.contentView = nil;
|
||||
|
||||
// create a new content view and add the stolen one as a subview
|
||||
mPanelButtons = [[QNSPanelContentsWrapper alloc] initWithPanelDelegate:self];
|
||||
@ -160,7 +160,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
|
||||
// return stolen stuff to its rightful owner
|
||||
[mStolenContentView removeFromSuperview];
|
||||
[mFontPanel setContentView:mStolenContentView];
|
||||
mStolenContentView = 0;
|
||||
mStolenContentView = nil;
|
||||
[mPanelButtons release];
|
||||
mPanelButtons = nil;
|
||||
}
|
||||
@ -192,7 +192,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate);
|
||||
// Get selected font
|
||||
NSFontManager *fontManager = [NSFontManager sharedFontManager];
|
||||
NSFont *selectedFont = [fontManager selectedFont];
|
||||
if (selectedFont == nil) {
|
||||
if (!selectedFont) {
|
||||
selectedFont = [NSFont systemFontOfSize:[NSFont systemFontSize]];
|
||||
}
|
||||
NSFont *panelFont = [fontManager convertFont:selectedFont];
|
||||
@ -296,7 +296,7 @@ public:
|
||||
void cleanup(QCocoaFontDialogHelper *helper)
|
||||
{
|
||||
if (mDelegate->mHelper == helper)
|
||||
mDelegate->mHelper = 0;
|
||||
mDelegate->mHelper = nullptr;
|
||||
}
|
||||
|
||||
bool exec()
|
||||
@ -330,7 +330,7 @@ public:
|
||||
void setCurrentFont(const QFont &font)
|
||||
{
|
||||
NSFontManager *mgr = [NSFontManager sharedFontManager];
|
||||
const NSFont *nsFont = 0;
|
||||
NSFont *nsFont = nil;
|
||||
|
||||
int weight = 5;
|
||||
NSFontTraitMask mask = 0;
|
||||
@ -348,7 +348,7 @@ public:
|
||||
weight:weight
|
||||
size:fontInfo.pointSize()];
|
||||
|
||||
[mgr setSelectedFont:const_cast<NSFont *>(nsFont) isMultiple:NO];
|
||||
[mgr setSelectedFont:nsFont isMultiple:NO];
|
||||
mDelegate->mQtFont = font;
|
||||
}
|
||||
|
||||
|
@ -386,7 +386,7 @@ void QCocoaGLContext::updateSurfaceFormat()
|
||||
void QCocoaGLContext::doneCurrent()
|
||||
{
|
||||
if (m_currentWindow && m_currentWindow.data()->handle())
|
||||
static_cast<QCocoaWindow *>(m_currentWindow.data()->handle())->setCurrentContext(0);
|
||||
static_cast<QCocoaWindow *>(m_currentWindow.data()->handle())->setCurrentContext(nullptr);
|
||||
|
||||
m_currentWindow.clear();
|
||||
|
||||
|
@ -94,11 +94,11 @@ static QCocoaIntegration::Options parseOptions(const QStringList ¶mList)
|
||||
return options;
|
||||
}
|
||||
|
||||
QCocoaIntegration *QCocoaIntegration::mInstance = 0;
|
||||
QCocoaIntegration *QCocoaIntegration::mInstance = nullptr;
|
||||
|
||||
QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList)
|
||||
: mOptions(parseOptions(paramList))
|
||||
, mFontDb(0)
|
||||
, mFontDb(nullptr)
|
||||
#ifndef QT_NO_ACCESSIBILITY
|
||||
, mAccessibility(new QCocoaAccessibility)
|
||||
#endif
|
||||
@ -110,7 +110,7 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList)
|
||||
, mServices(new QCocoaServices)
|
||||
, mKeyboardMapper(new QCocoaKeyMapper)
|
||||
{
|
||||
if (mInstance != 0)
|
||||
if (mInstance)
|
||||
qWarning("Creating multiple Cocoa platform integrations is not supported");
|
||||
mInstance = this;
|
||||
|
||||
@ -186,7 +186,7 @@ QCocoaIntegration::QCocoaIntegration(const QStringList ¶mList)
|
||||
|
||||
QCocoaIntegration::~QCocoaIntegration()
|
||||
{
|
||||
mInstance = 0;
|
||||
mInstance = nullptr;
|
||||
|
||||
qt_resetNSApplicationSendEvent();
|
||||
|
||||
@ -296,7 +296,7 @@ QCocoaScreen *QCocoaIntegration::screenForNSScreen(NSScreen *nsScreen)
|
||||
{
|
||||
NSUInteger index = [[NSScreen screens] indexOfObject:nsScreen];
|
||||
if (index == NSNotFound)
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (index >= unsigned(mScreens.count()))
|
||||
updateScreens();
|
||||
@ -306,7 +306,7 @@ QCocoaScreen *QCocoaIntegration::screenForNSScreen(NSScreen *nsScreen)
|
||||
return screen;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const
|
||||
@ -480,14 +480,14 @@ void QCocoaIntegration::pushPopupWindow(QCocoaWindow *window)
|
||||
QCocoaWindow *QCocoaIntegration::popPopupWindow()
|
||||
{
|
||||
if (m_popupWindowStack.isEmpty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
return m_popupWindowStack.takeLast();
|
||||
}
|
||||
|
||||
QCocoaWindow *QCocoaIntegration::activePopupWindow() const
|
||||
{
|
||||
if (m_popupWindowStack.isEmpty())
|
||||
return 0;
|
||||
return nullptr;
|
||||
return m_popupWindowStack.front();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
void qt_cocoa_change_implementation(Class baseClass, SEL originalSel, Class proxyClass, SEL replacementSel = 0, SEL backupSel = 0);
|
||||
void qt_cocoa_change_implementation(Class baseClass, SEL originalSel, Class proxyClass, SEL replacementSel = nil, SEL backupSel = nil);
|
||||
void qt_cocoa_change_back_implementation(Class baseClass, SEL originalSel, SEL backupSel);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -357,17 +357,17 @@ Qt::KeyboardModifiers QCocoaKeyMapper::queryKeyboardModifiers()
|
||||
|
||||
bool QCocoaKeyMapper::updateKeyboard()
|
||||
{
|
||||
const UCKeyboardLayout *uchrData = 0;
|
||||
const UCKeyboardLayout *uchrData = nullptr;
|
||||
QCFType<TISInputSourceRef> source = TISCopyInputMethodKeyboardLayoutOverride();
|
||||
if (!source)
|
||||
source = TISCopyCurrentKeyboardInputSource();
|
||||
if (keyboard_mode != NullMode && source == currentInputSource) {
|
||||
return false;
|
||||
}
|
||||
Q_ASSERT(source != 0);
|
||||
Q_ASSERT(source);
|
||||
CFDataRef data = static_cast<CFDataRef>(TISGetInputSourceProperty(source,
|
||||
kTISPropertyUnicodeKeyLayoutData));
|
||||
uchrData = data ? reinterpret_cast<const UCKeyboardLayout *>(CFDataGetBytePtr(data)) : 0;
|
||||
uchrData = data ? reinterpret_cast<const UCKeyboardLayout *>(CFDataGetBytePtr(data)) : nullptr;
|
||||
|
||||
keyboard_kind = LMGetKbdType();
|
||||
if (uchrData) {
|
||||
@ -386,7 +386,7 @@ void QCocoaKeyMapper::deleteLayouts()
|
||||
for (int i = 0; i < 255; ++i) {
|
||||
if (keyLayout[i]) {
|
||||
delete keyLayout[i];
|
||||
keyLayout[i] = 0;
|
||||
keyLayout[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QCocoaMenu::QCocoaMenu() :
|
||||
m_attachedItem(0),
|
||||
m_attachedItem(nil),
|
||||
m_updateTimer(0),
|
||||
m_enabled(true),
|
||||
m_parentEnabled(true),
|
||||
@ -69,7 +69,7 @@ QCocoaMenu::~QCocoaMenu()
|
||||
{
|
||||
foreach (QCocoaMenuItem *item, m_menuItems) {
|
||||
if (item->menuParent() == this)
|
||||
item->setMenuParent(0);
|
||||
item->setMenuParent(nullptr);
|
||||
}
|
||||
|
||||
[m_nativeMenu release];
|
||||
@ -187,7 +187,7 @@ void QCocoaMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
||||
}
|
||||
|
||||
if (cocoaItem->menuParent() == this)
|
||||
cocoaItem->setMenuParent(0);
|
||||
cocoaItem->setMenuParent(nullptr);
|
||||
|
||||
// Ignore any parent enabled state
|
||||
cocoaItem->setParentEnabled(true);
|
||||
@ -335,11 +335,11 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
QPoint pos = QPoint(targetRect.left(), targetRect.top() + targetRect.height());
|
||||
QCocoaWindow *cocoaWindow = parentWindow ? static_cast<QCocoaWindow *>(parentWindow->handle()) : 0;
|
||||
QCocoaWindow *cocoaWindow = parentWindow ? static_cast<QCocoaWindow *>(parentWindow->handle()) : nullptr;
|
||||
NSView *view = cocoaWindow ? cocoaWindow->view() : nil;
|
||||
NSMenuItem *nsItem = item ? ((QCocoaMenuItem *)item)->nsItem() : nil;
|
||||
|
||||
QScreen *screen = 0;
|
||||
QScreen *screen = nullptr;
|
||||
if (parentWindow)
|
||||
screen = parentWindow->screen();
|
||||
if (!screen && !QGuiApplication::screens().isEmpty())
|
||||
@ -403,7 +403,7 @@ void QCocoaMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect,
|
||||
pressure:1.0];
|
||||
[NSMenu popUpContextMenu:m_nativeMenu withEvent:menuEvent forView:view];
|
||||
} else {
|
||||
[m_nativeMenu popUpMenuPositioningItem:nsItem atLocation:nsPos inView:0];
|
||||
[m_nativeMenu popUpMenuPositioningItem:nsItem atLocation:nsPos inView:nil];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ QCocoaMenuBar::~QCocoaMenuBar()
|
||||
static_menubars.removeOne(this);
|
||||
|
||||
if (!m_window.isNull() && m_window->menubar() == this) {
|
||||
m_window->setMenubar(0);
|
||||
m_window->setMenubar(nullptr);
|
||||
|
||||
// Delete the children first so they do not cause
|
||||
// the native menu items to be hidden after
|
||||
@ -229,7 +229,7 @@ void QCocoaMenuBar::handleReparent(QWindow *newParentWindow)
|
||||
if (!m_window.isNull())
|
||||
m_window->setMenubar(nullptr);
|
||||
|
||||
if (newParentWindow == nullptr) {
|
||||
if (!newParentWindow) {
|
||||
m_window.clear();
|
||||
} else {
|
||||
newParentWindow->create();
|
||||
@ -264,7 +264,7 @@ void QCocoaMenuBar::updateMenuBarImmediately()
|
||||
QCocoaMenuBar *mb = findGlobalMenubar();
|
||||
QCocoaWindow *cw = findWindowForMenubar();
|
||||
|
||||
QWindow *win = cw ? cw->window() : 0;
|
||||
QWindow *win = cw ? cw->window() : nullptr;
|
||||
if (win && (win->flags() & Qt::Popup) == Qt::Popup) {
|
||||
// context menus, comboboxes, etc. don't need to update the menubar,
|
||||
// but if an application has only Qt::Tool window(s) on start,
|
||||
|
@ -113,7 +113,7 @@ QCocoaMenuItem::~QCocoaMenuItem()
|
||||
QMacAutoReleasePool pool;
|
||||
|
||||
if (m_menu && m_menu->menuParent() == this)
|
||||
m_menu->setMenuParent(0);
|
||||
m_menu->setMenuParent(nullptr);
|
||||
if (m_merged) {
|
||||
[m_native setHidden:YES];
|
||||
} else {
|
||||
@ -141,7 +141,7 @@ void QCocoaMenuItem::setMenu(QPlatformMenu *menu)
|
||||
return;
|
||||
|
||||
if (m_menu && m_menu->menuParent() == this) {
|
||||
m_menu->setMenuParent(0);
|
||||
m_menu->setMenuParent(nullptr);
|
||||
// Free the menu from its parent's influence
|
||||
m_menu->propagateEnabledState(true);
|
||||
if (m_native && m_menu->attachedItem() == m_native)
|
||||
|
@ -214,7 +214,7 @@
|
||||
#endif
|
||||
// Grab the app menu out of the current menu.
|
||||
int numItems = [mainMenu numberOfItems];
|
||||
NSMenuItem *oldAppMenuItem = 0;
|
||||
NSMenuItem *oldAppMenuItem = nil;
|
||||
for (int i = 0; i < numItems; ++i) {
|
||||
NSMenuItem *item = [mainMenu itemAtIndex:i];
|
||||
if ([item submenu] == appMenu) {
|
||||
|
@ -81,20 +81,20 @@ QCocoaNativeInterface::QCocoaNativeInterface()
|
||||
void *QCocoaNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context)
|
||||
{
|
||||
if (!context)
|
||||
return 0;
|
||||
return nullptr;
|
||||
if (resourceString.toLower() == "nsopenglcontext")
|
||||
return nsOpenGLContextForContext(context);
|
||||
if (resourceString.toLower() == "cglcontextobj")
|
||||
return cglContextForContext(context);
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window)
|
||||
{
|
||||
if (!window->handle())
|
||||
return 0;
|
||||
return nullptr;
|
||||
|
||||
if (resourceString == "nsview") {
|
||||
return static_cast<QCocoaWindow *>(window->handle())->m_view;
|
||||
@ -105,7 +105,7 @@ void *QCocoaNativeInterface::nativeResourceForWindow(const QByteArray &resourceS
|
||||
} else if (resourceString == "nswindow") {
|
||||
return static_cast<QCocoaWindow *>(window->handle())->nativeWindow();
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInterface::nativeResourceFunctionForIntegration(const QByteArray &resource)
|
||||
@ -143,7 +143,7 @@ QPlatformNativeInterface::NativeResourceForIntegrationFunction QCocoaNativeInter
|
||||
if (resource.toLower() == "testcontentborderposition")
|
||||
return NativeResourceForIntegrationFunction(QCocoaNativeInterface::testContentBorderPosition);
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
|
||||
@ -152,7 +152,7 @@ QPlatformPrinterSupport *QCocoaNativeInterface::createPlatformPrinterSupport()
|
||||
return new QCocoaPrinterSupport();
|
||||
#else
|
||||
qFatal("Printing is not supported when Qt is configured with -no-widgets");
|
||||
return 0;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine
|
||||
#else
|
||||
Q_UNUSED(printEngine);
|
||||
qFatal("Printing is not supported when Qt is configured with -no-widgets");
|
||||
return 0;
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -180,10 +180,10 @@ QPixmap QCocoaNativeInterface::defaultBackgroundPixmapForQWizard()
|
||||
CFURLRef url = (CFURLRef)CFArrayGetValueAtIndex(urls, 0);
|
||||
QCFType<CFBundleRef> bundle = CFBundleCreate(kCFAllocatorDefault, url);
|
||||
if (bundle) {
|
||||
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), 0);
|
||||
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("png"), nullptr);
|
||||
if (url) {
|
||||
QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
|
||||
QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
|
||||
QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, nullptr);
|
||||
QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, nullptr);
|
||||
if (image) {
|
||||
int width = CGImageGetWidth(image);
|
||||
int height = CGImageGetHeight(image);
|
||||
@ -213,7 +213,7 @@ void *QCocoaNativeInterface::cglContextForContext(QOpenGLContext* context)
|
||||
NSOpenGLContext *nsOpenGLContext = static_cast<NSOpenGLContext*>(nsOpenGLContextForContext(context));
|
||||
if (nsOpenGLContext)
|
||||
return [nsOpenGLContext CGLContextObj];
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void *QCocoaNativeInterface::nsOpenGLContextForContext(QOpenGLContext* context)
|
||||
@ -224,7 +224,7 @@ void *QCocoaNativeInterface::nsOpenGLContextForContext(QOpenGLContext* context)
|
||||
return cocoaGLContext->nsOpenGLContext();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -67,17 +67,17 @@ static QPrint::DuplexMode macToDuplexMode(const PMDuplexMode &mode)
|
||||
|
||||
QCocoaPrintDevice::QCocoaPrintDevice()
|
||||
: QPlatformPrintDevice(),
|
||||
m_printer(0),
|
||||
m_session(0),
|
||||
m_ppd(0)
|
||||
m_printer(nullptr),
|
||||
m_session(nullptr),
|
||||
m_ppd(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
QCocoaPrintDevice::QCocoaPrintDevice(const QString &id)
|
||||
: QPlatformPrintDevice(id),
|
||||
m_printer(0),
|
||||
m_session(0),
|
||||
m_ppd(0)
|
||||
m_printer(nullptr),
|
||||
m_session(nullptr),
|
||||
m_ppd(nullptr)
|
||||
{
|
||||
if (!id.isEmpty()) {
|
||||
m_printer = PMPrinterCreateFromPrinterID(id.toCFString());
|
||||
@ -443,7 +443,7 @@ bool QCocoaPrintDevice::openPpdFile()
|
||||
{
|
||||
if (m_ppd)
|
||||
ppdClose(m_ppd);
|
||||
m_ppd = 0;
|
||||
m_ppd = nullptr;
|
||||
CFURLRef ppdURL = NULL;
|
||||
char ppdPath[MAXPATHLEN];
|
||||
if (PMPrinterCopyDescriptionURL(m_printer, kPMPPDDescriptionType, &ppdURL) == noErr
|
||||
@ -470,7 +470,7 @@ PMPaper QCocoaPrintDevice::macPaper(const QPageSize &pageSize) const
|
||||
if (m_macPapers.contains(pageSize.key()))
|
||||
return m_macPapers.value(pageSize.key());
|
||||
// For any other page size, whether custom or just unsupported, needs to be a custom PMPaper
|
||||
PMPaper paper = 0;
|
||||
PMPaper paper = nullptr;
|
||||
PMPaperMargins paperMargins;
|
||||
paperMargins.left = m_customMargins.left();
|
||||
paperMargins.right = m_customMargins.right();
|
||||
|
@ -164,7 +164,7 @@ QWindow *QCocoaScreen::topLevelAt(const QPoint &point) const
|
||||
// belowWindowWithWindowNumber] may return windows that are not interesting
|
||||
// to Qt. The search iterates until a suitable window or no window is found.
|
||||
NSInteger topWindowNumber = 0;
|
||||
QWindow *window = 0;
|
||||
QWindow *window = nullptr;
|
||||
do {
|
||||
// Get the top-most window, below any previously rejected window.
|
||||
topWindowNumber = [NSWindow windowNumberAtPoint:screenPoint
|
||||
@ -172,7 +172,7 @@ QWindow *QCocoaScreen::topLevelAt(const QPoint &point) const
|
||||
|
||||
// Continue the search if the window does not belong to this process.
|
||||
NSWindow *nsWindow = [NSApp windowWithWindowNumber:topWindowNumber];
|
||||
if (nsWindow == 0)
|
||||
if (!nsWindow)
|
||||
continue;
|
||||
|
||||
// Continue the search if the window does not belong to Qt.
|
||||
|
@ -129,7 +129,7 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes()
|
||||
QColor qc;
|
||||
for (int i = 0; i < mac_widget_colors_count; i++) {
|
||||
QPalette &pal = *qt_mac_createSystemPalette();
|
||||
if (mac_widget_colors[i].active != 0) {
|
||||
if (mac_widget_colors[i].active) {
|
||||
qc = qt_mac_toQColor(mac_widget_colors[i].active);
|
||||
pal.setColor(QPalette::Active, QPalette::Text, qc);
|
||||
pal.setColor(QPalette::Inactive, QPalette::Text, qc);
|
||||
|
@ -55,7 +55,7 @@ class QSystemTrayIconSys;
|
||||
class Q_GUI_EXPORT QCocoaSystemTrayIcon : public QPlatformSystemTrayIcon
|
||||
{
|
||||
public:
|
||||
QCocoaSystemTrayIcon() : m_sys(0) {}
|
||||
QCocoaSystemTrayIcon() : m_sys(nullptr) {}
|
||||
|
||||
void init() override;
|
||||
void cleanup() override;
|
||||
|
@ -147,7 +147,7 @@ QRect QCocoaSystemTrayIcon::geometry() const
|
||||
void QCocoaSystemTrayIcon::cleanup()
|
||||
{
|
||||
delete m_sys;
|
||||
m_sys = 0;
|
||||
m_sys = nullptr;
|
||||
}
|
||||
|
||||
static bool heightCompareFunction (QSize a, QSize b) { return (a.height() < b.height()); }
|
||||
@ -363,7 +363,7 @@ QT_END_NAMESPACE
|
||||
self = [super init];
|
||||
if (self) {
|
||||
item = [[[NSStatusBar systemStatusBar] statusItemWithLength:NSSquareStatusItemLength] retain];
|
||||
menu = 0;
|
||||
menu = nullptr;
|
||||
systray = sys;
|
||||
imageCell = [[QNSImageView alloc] initWithParent:self];
|
||||
[item setView: imageCell];
|
||||
|
@ -105,7 +105,7 @@ QT_BEGIN_NAMESPACE
|
||||
const char *QCocoaTheme::name = "cocoa";
|
||||
|
||||
QCocoaTheme::QCocoaTheme()
|
||||
:m_systemPalette(0)
|
||||
: m_systemPalette(nullptr)
|
||||
{
|
||||
m_notificationReceiver = [[QT_MANGLE_NAMESPACE(QCocoaThemeNotificationReceiver) alloc] initWithPrivate:this];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:m_notificationReceiver
|
||||
@ -145,7 +145,7 @@ bool QCocoaTheme::usePlatformNativeDialog(DialogType dialogType) const
|
||||
return false;
|
||||
}
|
||||
|
||||
QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const
|
||||
QPlatformDialogHelper *QCocoaTheme::createPlatformDialogHelper(DialogType dialogType) const
|
||||
{
|
||||
switch (dialogType) {
|
||||
#if defined(QT_WIDGETS_LIB) && QT_CONFIG(filedialog)
|
||||
@ -161,7 +161,7 @@ QPlatformDialogHelper * QCocoaTheme::createPlatformDialogHelper(DialogType dialo
|
||||
return new QCocoaFontDialogHelper();
|
||||
#endif
|
||||
default:
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,9 +181,9 @@ const QPalette *QCocoaTheme::palette(Palette type) const
|
||||
} else {
|
||||
if (m_palettes.isEmpty())
|
||||
m_palettes = qt_mac_createRolePalettes();
|
||||
return m_palettes.value(type, 0);
|
||||
return m_palettes.value(type, nullptr);
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QHash<QPlatformTheme::Font, QFont *> qt_mac_createRoleFonts()
|
||||
@ -197,7 +197,7 @@ const QFont *QCocoaTheme::font(Font type) const
|
||||
if (m_fonts.isEmpty()) {
|
||||
m_fonts = qt_mac_createRoleFonts();
|
||||
}
|
||||
return m_fonts.value(type, 0);
|
||||
return m_fonts.value(type, nullptr);
|
||||
}
|
||||
|
||||
//! \internal
|
||||
|
@ -143,7 +143,7 @@ const int QCocoaWindow::NoAlertRequest = -1;
|
||||
QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle)
|
||||
: QPlatformWindow(win)
|
||||
, m_view(nil)
|
||||
, m_nsWindow(0)
|
||||
, m_nsWindow(nil)
|
||||
, m_lastReportedWindowState(Qt::WindowNoState)
|
||||
, m_windowModality(Qt::NonModal)
|
||||
, m_windowUnderMouse(false)
|
||||
@ -152,9 +152,9 @@ QCocoaWindow::QCocoaWindow(QWindow *win, WId nativeHandle)
|
||||
, m_inSetGeometry(false)
|
||||
, m_inSetStyleMask(false)
|
||||
#ifndef QT_NO_OPENGL
|
||||
, m_glContext(0)
|
||||
, m_glContext(nullptr)
|
||||
#endif
|
||||
, m_menubar(0)
|
||||
, m_menubar(nullptr)
|
||||
, m_needsInvalidateShadow(false)
|
||||
, m_hasModalSession(false)
|
||||
, m_frameStrutEventsEnabled(false)
|
||||
@ -316,7 +316,7 @@ void QCocoaWindow::setVisible(bool visible)
|
||||
m_inSetVisible = true;
|
||||
|
||||
QMacAutoReleasePool pool;
|
||||
QCocoaWindow *parentCocoaWindow = 0;
|
||||
QCocoaWindow *parentCocoaWindow = nullptr;
|
||||
if (window()->transientParent())
|
||||
parentCocoaWindow = static_cast<QCocoaWindow *>(window()->transientParent()->handle());
|
||||
|
||||
@ -368,13 +368,13 @@ void QCocoaWindow::setVisible(bool visible)
|
||||
} else if (window()->modality() != Qt::NonModal) {
|
||||
// show the window as application modal
|
||||
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
||||
Q_ASSERT(cocoaEventDispatcher != 0);
|
||||
Q_ASSERT(cocoaEventDispatcher);
|
||||
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
|
||||
cocoaEventDispatcherPrivate->beginModalSession(window());
|
||||
m_hasModalSession = true;
|
||||
} else if ([m_view.window canBecomeKeyWindow]) {
|
||||
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
||||
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = 0;
|
||||
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = nullptr;
|
||||
if (cocoaEventDispatcher)
|
||||
cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
|
||||
|
||||
@ -413,7 +413,7 @@ void QCocoaWindow::setVisible(bool visible)
|
||||
m_glContext->windowWasHidden();
|
||||
#endif
|
||||
QCocoaEventDispatcher *cocoaEventDispatcher = qobject_cast<QCocoaEventDispatcher *>(QGuiApplication::instance()->eventDispatcher());
|
||||
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = 0;
|
||||
QCocoaEventDispatcherPrivate *cocoaEventDispatcherPrivate = nullptr;
|
||||
if (cocoaEventDispatcher)
|
||||
cocoaEventDispatcherPrivate = static_cast<QCocoaEventDispatcherPrivate *>(QObjectPrivate::get(cocoaEventDispatcher));
|
||||
if (isContentView()) {
|
||||
@ -481,7 +481,8 @@ NSInteger QCocoaWindow::windowLevel(Qt::WindowFlags flags)
|
||||
// Any "special" window should be in at least the same level as its parent.
|
||||
if (type != Qt::Window) {
|
||||
const QWindow * const transientParent = window()->transientParent();
|
||||
const QCocoaWindow * const transientParentWindow = transientParent ? static_cast<QCocoaWindow *>(transientParent->handle()) : 0;
|
||||
const QCocoaWindow * const transientParentWindow = transientParent ?
|
||||
static_cast<QCocoaWindow *>(transientParent->handle()) : nullptr;
|
||||
if (transientParentWindow)
|
||||
windowLevel = qMax([transientParentWindow->nativeWindow() level], windowLevel);
|
||||
}
|
||||
@ -1276,18 +1277,13 @@ void QCocoaWindow::recreateWindowIfNeeded()
|
||||
// with a NSWindow contentView pointing to a deallocated NSView.
|
||||
m_view.window.contentView = nil;
|
||||
}
|
||||
m_nsWindow = 0;
|
||||
m_nsWindow = nil;
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldBeContentView) {
|
||||
bool noPreviousWindow = m_nsWindow == 0;
|
||||
QCocoaNSWindow *newWindow = nullptr;
|
||||
if (noPreviousWindow)
|
||||
newWindow = createNSWindow(shouldBePanel);
|
||||
|
||||
if (shouldBeContentView && !m_nsWindow) {
|
||||
// Move view to new NSWindow if needed
|
||||
if (newWindow) {
|
||||
if (auto *newWindow = createNSWindow(shouldBePanel)) {
|
||||
qCDebug(lcQpaWindow) << "Ensuring that" << m_view << "is content view for" << newWindow;
|
||||
[m_view setPostsFrameChangedNotifications:NO];
|
||||
[newWindow setContentView:m_view];
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
enum DataRequestType { EagerRequest, LazyRequest };
|
||||
private:
|
||||
struct Promise {
|
||||
Promise() : itemId(0), convertor(0) { }
|
||||
Promise() : itemId(0), convertor(nullptr) { }
|
||||
|
||||
static Promise eagerPromise(int itemId, QMacInternalPasteboardMime *c, QString m, QMacMimeData *d, int o = 0);
|
||||
static Promise lazyPromise(int itemId, QMacInternalPasteboardMime *c, QString m, QMacMimeData *d, int o = 0);
|
||||
@ -79,7 +79,7 @@ private:
|
||||
public:
|
||||
QMacPasteboard(PasteboardRef p, uchar mime_type=0);
|
||||
QMacPasteboard(uchar mime_type);
|
||||
QMacPasteboard(CFStringRef name=0, uchar mime_type=0);
|
||||
QMacPasteboard(CFStringRef name=nullptr, uchar mime_type=0);
|
||||
~QMacPasteboard();
|
||||
|
||||
bool hasFlavor(QString flavor) const;
|
||||
|
@ -75,7 +75,7 @@ QMacPasteboard::Promise::Promise(int itemId, QMacInternalPasteboardMime *c, QStr
|
||||
// Request the data from the application immediately for eager requests.
|
||||
if (dataRequestType == QMacPasteboard::EagerRequest) {
|
||||
variantData = md->variantData(m);
|
||||
mimeData = 0;
|
||||
mimeData = nullptr;
|
||||
} else {
|
||||
mimeData = md;
|
||||
}
|
||||
@ -94,8 +94,8 @@ QMacPasteboard::QMacPasteboard(uchar mt)
|
||||
{
|
||||
mac_mime_source = false;
|
||||
mime_type = mt ? mt : uchar(QMacInternalPasteboardMime::MIME_ALL);
|
||||
paste = 0;
|
||||
OSStatus err = PasteboardCreate(0, &paste);
|
||||
paste = nullptr;
|
||||
OSStatus err = PasteboardCreate(nullptr, &paste);
|
||||
if (err == noErr) {
|
||||
PasteboardSetPromiseKeeper(paste, promiseKeeper, this);
|
||||
} else {
|
||||
@ -108,7 +108,7 @@ QMacPasteboard::QMacPasteboard(CFStringRef name, uchar mt)
|
||||
{
|
||||
mac_mime_source = false;
|
||||
mime_type = mt ? mt : uchar(QMacInternalPasteboardMime::MIME_ALL);
|
||||
paste = 0;
|
||||
paste = nullptr;
|
||||
OSStatus err = PasteboardCreate(name, &paste);
|
||||
if (err == noErr) {
|
||||
PasteboardSetPromiseKeeper(paste, promiseKeeper, this);
|
||||
@ -165,7 +165,7 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id,
|
||||
// we have promised this data, but won't be able to convert, so return null data.
|
||||
// This helps in making the application/x-qt-mime-type-name hidden from normal use.
|
||||
QByteArray ba;
|
||||
QCFType<CFDataRef> data = CFDataCreate(0, (UInt8*)ba.constData(), ba.size());
|
||||
QCFType<CFDataRef> data = CFDataCreate(nullptr, (UInt8*)ba.constData(), ba.size());
|
||||
PasteboardPutItemFlavor(paste, id, flavor, data, kPasteboardFlavorNoFlags);
|
||||
return noErr;
|
||||
}
|
||||
@ -196,7 +196,7 @@ OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id,
|
||||
if (md.size() <= promise.offset)
|
||||
return cantGetFlavorErr;
|
||||
const QByteArray &ba = md[promise.offset];
|
||||
QCFType<CFDataRef> data = CFDataCreate(0, (UInt8*)ba.constData(), ba.size());
|
||||
QCFType<CFDataRef> data = CFDataCreate(nullptr, (UInt8*)ba.constData(), ba.size());
|
||||
PasteboardPutItemFlavor(paste, id, flavor, data, kPasteboardFlavorNoFlags);
|
||||
return noErr;
|
||||
}
|
||||
@ -553,7 +553,7 @@ QMacPasteboard::sync() const
|
||||
const bool fromGlobal = PasteboardSynchronize(paste) & kPasteboardModified;
|
||||
|
||||
if (fromGlobal)
|
||||
const_cast<QMacPasteboard *>(this)->setMimeData(0);
|
||||
const_cast<QMacPasteboard *>(this)->setMimeData(nullptr);
|
||||
|
||||
#ifdef DEBUG_PASTEBOARD
|
||||
if (fromGlobal)
|
||||
|
@ -107,7 +107,7 @@ QCocoaTouch *QCocoaTouch::findQCocoaTouch(NSTouch *nstouch)
|
||||
qint64 identity = qint64([nstouch identity]);
|
||||
if (_currentTouches.contains(identity))
|
||||
return _currentTouches.value(identity);
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Qt::TouchPointState QCocoaTouch::toTouchPointState(NSTouchPhase nsState)
|
||||
|
@ -148,18 +148,18 @@
|
||||
m_frameStrutButtons = Qt::NoButton;
|
||||
m_sendKeyEvent = false;
|
||||
#ifndef QT_NO_OPENGL
|
||||
m_glContext = 0;
|
||||
m_glContext = nullptr;
|
||||
m_shouldSetGLContextinDrawRect = false;
|
||||
#endif
|
||||
currentCustomDragTypes = 0;
|
||||
currentCustomDragTypes = nullptr;
|
||||
m_dontOverrideCtrlLMB = false;
|
||||
m_sendUpAsRightButton = false;
|
||||
m_inputSource = 0;
|
||||
m_inputSource = nil;
|
||||
m_mouseMoveHelper = [[QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper) alloc] initWithView:self];
|
||||
m_resendKeyEvent = false;
|
||||
m_scrolling = false;
|
||||
m_updatingDrag = false;
|
||||
m_currentlyInterpretedKeyEvent = 0;
|
||||
m_currentlyInterpretedKeyEvent = nil;
|
||||
self.focusRingType = NSFocusRingTypeNone;
|
||||
self.cursor = nil;
|
||||
m_updateRequested = false;
|
||||
|
@ -98,8 +98,8 @@ CGImageRef qt_mac_create_imagemask(const QPixmap &pixmap, const QRectF &sr)
|
||||
for (int x = sx; x < sw; ++x)
|
||||
*(dptr+(offset++)) = (*(srow+x) & mask) ? 255 : 0;
|
||||
}
|
||||
QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, dptr, nbytes, qt_mac_cgimage_data_free);
|
||||
return CGImageMaskCreate(sw, sh, 8, 8, nbytes / sh, provider, 0, 0);
|
||||
QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(nullptr, dptr, nbytes, qt_mac_cgimage_data_free);
|
||||
return CGImageMaskCreate(sw, sh, 8, 8, nbytes / sh, provider, nullptr, false);
|
||||
}
|
||||
|
||||
//conversion
|
||||
@ -287,16 +287,16 @@ static void qt_mac_draw_pattern(void *info, CGContextRef c)
|
||||
Q_ASSERT(pat->data.bytes);
|
||||
w = h = 8;
|
||||
#if (QMACPATTERN_MASK_MULTIPLIER == 1)
|
||||
CGDataProviderRef provider = CGDataProviderCreateWithData(0, pat->data.bytes, w*h, 0);
|
||||
pat->image = CGImageMaskCreate(w, h, 1, 1, 1, provider, 0, false);
|
||||
CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, pat->data.bytes, w*h, nullptr);
|
||||
pat->image = CGImageMaskCreate(w, h, 1, 1, 1, provider, nullptr, false);
|
||||
CGDataProviderRelease(provider);
|
||||
#else
|
||||
const int numBytes = (w*h)/sizeof(uchar);
|
||||
uchar xor_bytes[numBytes];
|
||||
for (int i = 0; i < numBytes; ++i)
|
||||
xor_bytes[i] = pat->data.bytes[i] ^ 0xFF;
|
||||
CGDataProviderRef provider = CGDataProviderCreateWithData(0, xor_bytes, w*h, 0);
|
||||
CGImageRef swatch = CGImageMaskCreate(w, h, 1, 1, 1, provider, 0, false);
|
||||
CGDataProviderRef provider = CGDataProviderCreateWithData(nullptr, xor_bytes, w*h, nullptr);
|
||||
CGImageRef swatch = CGImageMaskCreate(w, h, 1, 1, 1, provider, nullptr, false);
|
||||
CGDataProviderRelease(provider);
|
||||
|
||||
const QColor c0(0, 0, 0, 0), c1(255, 255, 255, 255);
|
||||
@ -399,9 +399,9 @@ QCoreGraphicsPaintEngine::begin(QPaintDevice *pdev)
|
||||
d->orig_xform = CGContextGetCTM(d->hd);
|
||||
if (d->shading) {
|
||||
CGShadingRelease(d->shading);
|
||||
d->shading = 0;
|
||||
d->shading = nullptr;
|
||||
}
|
||||
d->setClip(0); //clear the context's clipping
|
||||
d->setClip(nullptr); //clear the context's clipping
|
||||
}
|
||||
|
||||
setActive(true);
|
||||
@ -445,12 +445,12 @@ QCoreGraphicsPaintEngine::end()
|
||||
CGShadingRelease(d->shading);
|
||||
d->shading = 0;
|
||||
}
|
||||
d->pdev = 0;
|
||||
d->pdev = nullptr;
|
||||
if (d->hd) {
|
||||
d->restoreGraphicsState();
|
||||
CGContextSynchronize(d->hd);
|
||||
CGContextRelease(d->hd);
|
||||
d->hd = 0;
|
||||
d->hd = nullptr;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -545,7 +545,7 @@ QCoreGraphicsPaintEngine::updateBrush(const QBrush &brush, const QPointF &brushO
|
||||
|
||||
if (d->shading) {
|
||||
CGShadingRelease(d->shading);
|
||||
d->shading = 0;
|
||||
d->shading = nullptr;
|
||||
}
|
||||
d->setFillBrush(brushOrigin);
|
||||
}
|
||||
@ -592,7 +592,7 @@ QCoreGraphicsPaintEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperatio
|
||||
if (d->current.clipEnabled) {
|
||||
d->current.clipEnabled = false;
|
||||
d->current.clip = QRegion();
|
||||
d->setClip(0);
|
||||
d->setClip(nullptr);
|
||||
}
|
||||
} else {
|
||||
if (!d->current.clipEnabled)
|
||||
@ -601,7 +601,7 @@ QCoreGraphicsPaintEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperatio
|
||||
QRegion clipRegion(p.toFillPolygon().toPolygon(), p.fillRule());
|
||||
if (op == Qt::ReplaceClip) {
|
||||
d->current.clip = clipRegion;
|
||||
d->setClip(0);
|
||||
d->setClip(nullptr);
|
||||
if (p.isEmpty()) {
|
||||
CGRect rect = CGRectMake(0, 0, 0, 0);
|
||||
CGContextClipToRect(d->hd, rect);
|
||||
@ -630,7 +630,7 @@ QCoreGraphicsPaintEngine::updateClipRegion(const QRegion &clipRegion, Qt::ClipOp
|
||||
if (op == Qt::NoClip) {
|
||||
d->current.clipEnabled = false;
|
||||
d->current.clip = QRegion();
|
||||
d->setClip(0);
|
||||
d->setClip(nullptr);
|
||||
} else {
|
||||
if (!d->current.clipEnabled)
|
||||
op = Qt::ReplaceClip;
|
||||
@ -676,7 +676,7 @@ QCoreGraphicsPaintEngine::drawRects(const QRectF *rects, int rectCount)
|
||||
QRectF r = rects[i];
|
||||
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
CGPathAddRect(path, 0, qt_mac_compose_rect(r));
|
||||
CGPathAddRect(path, nullptr, qt_mac_compose_rect(r));
|
||||
d->drawPath(QCoreGraphicsPaintEnginePrivate::CGFill|QCoreGraphicsPaintEnginePrivate::CGStroke,
|
||||
path);
|
||||
CGPathRelease(path);
|
||||
@ -698,8 +698,8 @@ QCoreGraphicsPaintEngine::drawPoints(const QPointF *points, int pointCount)
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
for (int i=0; i < pointCount; i++) {
|
||||
float x = points[i].x(), y = points[i].y();
|
||||
CGPathMoveToPoint(path, 0, x, y);
|
||||
CGPathAddLineToPoint(path, 0, x+0.001, y);
|
||||
CGPathMoveToPoint(path, nullptr, x, y);
|
||||
CGPathAddLineToPoint(path, nullptr, x+0.001, y);
|
||||
}
|
||||
|
||||
bool doRestore = false;
|
||||
@ -745,11 +745,11 @@ QCoreGraphicsPaintEngine::drawPolygon(const QPointF *points, int pointCount, Pol
|
||||
return;
|
||||
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
CGPathMoveToPoint(path, 0, points[0].x(), points[0].y());
|
||||
CGPathMoveToPoint(path, nullptr, points[0].x(), points[0].y());
|
||||
for (int x = 1; x < pointCount; ++x)
|
||||
CGPathAddLineToPoint(path, 0, points[x].x(), points[x].y());
|
||||
CGPathAddLineToPoint(path, nullptr, points[x].x(), points[x].y());
|
||||
if (mode != PolylineMode && points[0] != points[pointCount-1])
|
||||
CGPathAddLineToPoint(path, 0, points[0].x(), points[0].y());
|
||||
CGPathAddLineToPoint(path, nullptr, points[0].x(), points[0].y());
|
||||
uint op = QCoreGraphicsPaintEnginePrivate::CGStroke;
|
||||
if (mode != PolylineMode)
|
||||
op |= mode == OddEvenMode ? QCoreGraphicsPaintEnginePrivate::CGEOFill
|
||||
@ -770,8 +770,8 @@ QCoreGraphicsPaintEngine::drawLines(const QLineF *lines, int lineCount)
|
||||
CGMutablePathRef path = CGPathCreateMutable();
|
||||
for (int i = 0; i < lineCount; i++) {
|
||||
const QPointF start = lines[i].p1(), end = lines[i].p2();
|
||||
CGPathMoveToPoint(path, 0, start.x(), start.y());
|
||||
CGPathAddLineToPoint(path, 0, end.x(), end.y());
|
||||
CGPathMoveToPoint(path, nullptr, start.x(), start.y());
|
||||
CGPathAddLineToPoint(path, nullptr, end.x(), end.y());
|
||||
}
|
||||
d->drawPath(QCoreGraphicsPaintEnginePrivate::CGStroke, path);
|
||||
CGPathRelease(path);
|
||||
@ -870,7 +870,7 @@ QCoreGraphicsPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap
|
||||
CGPatternRef pat = CGPatternCreate(qpattern, CGRectMake(0, 0, width, height),
|
||||
trans, width, height,
|
||||
kCGPatternTilingNoDistortion, true, &callbks);
|
||||
CGColorSpaceRef cs = CGColorSpaceCreatePattern(0);
|
||||
CGColorSpaceRef cs = CGColorSpaceCreatePattern(nullptr);
|
||||
CGContextSetFillColorSpace(d->hd, cs);
|
||||
CGFloat component = 1.0; //just one
|
||||
CGContextSetFillPattern(d->hd, pat, &component);
|
||||
@ -1198,9 +1198,9 @@ void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
|
||||
Q_ASSERT(grad->spread() == QGradient::PadSpread);
|
||||
|
||||
static const CGFloat domain[] = { 0.0f, +1.0f };
|
||||
static const CGFunctionCallbacks callbacks = { 0, qt_mac_color_gradient_function, 0 };
|
||||
static const CGFunctionCallbacks callbacks = { 0, qt_mac_color_gradient_function, nullptr };
|
||||
CGFunctionRef fill_func = CGFunctionCreate(reinterpret_cast<void *>(¤t.brush),
|
||||
1, domain, 4, 0, &callbacks);
|
||||
1, domain, 4, nullptr, &callbacks);
|
||||
|
||||
CGColorSpaceRef colorspace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB)
|
||||
if (bs == Qt::LinearGradientPattern) {
|
||||
@ -1233,7 +1233,7 @@ void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
|
||||
QMacPattern *qpattern = new QMacPattern;
|
||||
qpattern->pdev = pdev;
|
||||
CGFloat components[4] = { 1.0, 1.0, 1.0, 1.0 };
|
||||
CGColorSpaceRef base_colorspace = 0;
|
||||
CGColorSpaceRef base_colorspace = nullptr;
|
||||
if (bs == Qt::TexturePattern) {
|
||||
qpattern->data.pixmap = current.brush.texture();
|
||||
if (qpattern->data.pixmap.isQBitmap()) {
|
||||
@ -1291,7 +1291,7 @@ QCoreGraphicsPaintEnginePrivate::setClip(const QRegion *rgn)
|
||||
if (!sysClip.isEmpty())
|
||||
qt_mac_clip_cg(hd, sysClip, &orig_xform);
|
||||
if (rgn)
|
||||
qt_mac_clip_cg(hd, *rgn, 0);
|
||||
qt_mac_clip_cg(hd, *rgn, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1404,7 +1404,7 @@ void QCoreGraphicsPaintEnginePrivate::drawPath(uchar ops, CGMutablePathRef path)
|
||||
t.transform = qt_mac_convert_transform_to_cg(current.transform);
|
||||
t.path = CGPathCreateMutable();
|
||||
CGPathApply(path, &t, qt_mac_cg_transform_path_apply); //transform the path
|
||||
setTransform(0); //unset the context transform
|
||||
setTransform(nullptr); //unset the context transform
|
||||
CGContextSetLineWidth(hd, cosmeticPenSize);
|
||||
CGContextAddPath(hd, t.path);
|
||||
CGPathRelease(t.path);
|
||||
|
@ -135,7 +135,7 @@ class QCoreGraphicsPaintEnginePrivate : public QPaintEnginePrivate
|
||||
Q_DECLARE_PUBLIC(QCoreGraphicsPaintEngine)
|
||||
public:
|
||||
QCoreGraphicsPaintEnginePrivate()
|
||||
: hd(0), shading(0), stackCount(0), complexXForm(false), disabledSmoothFonts(false)
|
||||
: hd(nullptr), shading(nullptr), stackCount(0), complexXForm(false), disabledSmoothFonts(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -164,8 +164,8 @@ public:
|
||||
|
||||
//internal functions
|
||||
enum { CGStroke=0x01, CGEOFill=0x02, CGFill=0x04 };
|
||||
void drawPath(uchar ops, CGMutablePathRef path = 0);
|
||||
void setClip(const QRegion *rgn=0);
|
||||
void drawPath(uchar ops, CGMutablePathRef path = nullptr);
|
||||
void setClip(const QRegion *rgn = nullptr);
|
||||
void resetClip();
|
||||
void setFillBrush(const QPointF &origin=QPoint());
|
||||
void setStrokePen(const QPen &pen);
|
||||
@ -174,7 +174,7 @@ public:
|
||||
float penOffset();
|
||||
QPointF devicePixelSize(CGContextRef context);
|
||||
float adjustPenWidth(float penWidth);
|
||||
inline void setTransform(const QTransform *matrix=0)
|
||||
inline void setTransform(const QTransform *matrix = nullptr)
|
||||
{
|
||||
CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
|
||||
CGAffineTransform xform = orig_xform;
|
||||
|
@ -117,7 +117,7 @@ bool QMacPrintEngine::end()
|
||||
if (d->paintEngine->type() == QPaintEngine::CoreGraphics) {
|
||||
// We don't need the paint engine to call restoreGraphicsState()
|
||||
static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->stackCount = 0;
|
||||
static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->hd = 0;
|
||||
static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->hd = nullptr;
|
||||
}
|
||||
d->paintEngine->end();
|
||||
if (d->state != QPrinter::Idle)
|
||||
@ -271,7 +271,7 @@ void QMacPrintEnginePrivate::releaseSession()
|
||||
PMSessionEndPageNoDialog(session());
|
||||
PMSessionEndDocumentNoDialog(session());
|
||||
[printInfo release];
|
||||
printInfo = 0;
|
||||
printInfo = nil;
|
||||
}
|
||||
|
||||
bool QMacPrintEnginePrivate::newPage_helper()
|
||||
@ -291,7 +291,7 @@ bool QMacPrintEnginePrivate::newPage_helper()
|
||||
while (cgEngine->d_func()->stackCount > 0)
|
||||
cgEngine->d_func()->restoreGraphicsState();
|
||||
|
||||
OSStatus status = PMSessionBeginPageNoDialog(session(), format(), 0);
|
||||
OSStatus status = PMSessionBeginPageNoDialog(session(), format(), nullptr);
|
||||
if (status != noErr) {
|
||||
state = QPrinter::Error;
|
||||
return false;
|
||||
@ -318,7 +318,7 @@ bool QMacPrintEnginePrivate::newPage_helper()
|
||||
if (m_pageLayout.mode() != QPageLayout::FullPageMode)
|
||||
CGContextTranslateCTM(cgContext, page.x() - paper.x(), page.y() - paper.y());
|
||||
cgEngine->d_func()->orig_xform = CGContextGetCTM(cgContext);
|
||||
cgEngine->d_func()->setClip(0);
|
||||
cgEngine->d_func()->setClip(nullptr);
|
||||
cgEngine->state->dirtyFlags = QPaintEngine::DirtyFlag(QPaintEngine::AllDirty
|
||||
& ~(QPaintEngine::DirtyClipEnabled
|
||||
| QPaintEngine::DirtyClipRegion
|
||||
@ -340,7 +340,7 @@ void QMacPrintEnginePrivate::setPageSize(const QPageSize &pageSize)
|
||||
|
||||
// Get the PMPaper and check it is valid
|
||||
PMPaper macPaper = m_printDevice->macPaper(usePageSize);
|
||||
if (macPaper == 0) {
|
||||
if (!macPaper) {
|
||||
qWarning() << "QMacPrintEngine: Invalid PMPaper returned for " << pageSize;
|
||||
return;
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ public:
|
||||
|
||||
QMacPrintEnginePrivate() : mode(QPrinter::ScreenResolution), state(QPrinter::Idle),
|
||||
m_pageLayout(QPageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0, 0, 0, 0))),
|
||||
printInfo(0), paintEngine(0), embedFonts(true) {}
|
||||
printInfo(nullptr), paintEngine(nullptr), embedFonts(true) {}
|
||||
~QMacPrintEnginePrivate();
|
||||
|
||||
void initialize();
|
||||
|
Loading…
Reference in New Issue
Block a user