summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-06-11 21:01:35 (GMT)
committerNorwegian Rock Cat <qt-info@nokia.com>2009-06-23 14:19:05 (GMT)
commit48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a (patch)
tree335822e20cda6614f0cbc5c4fb21c369146a1ad3 /src/gui
parent9205078f3b2d842735599fd74d6324a4d84bc275 (diff)
downloadQt-48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a.zip
Qt-48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a.tar.gz
Qt-48fe6dfaf0a52e8a0463fe3fd23015ea63d9d65a.tar.bz2
More culling of Panther Code.
Removed lots of places where we check for Tiger. Now we can assume it. Reviewed-by: Morten Sørvig
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible_mac.mm14
-rw-r--r--src/gui/dialogs/qwizard.cpp83
-rw-r--r--src/gui/image/qicon.cpp6
-rw-r--r--src/gui/image/qnativeimage.cpp3
-rw-r--r--src/gui/image/qpixmap_mac.cpp79
-rw-r--r--src/gui/kernel/qmime_mac.cpp40
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm9
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h2
-rw-r--r--src/gui/kernel/qwidget_mac.mm251
-rw-r--r--src/gui/painting/qpaintdevice_mac.cpp7
-rw-r--r--src/gui/painting/qpaintengine_mac.cpp81
-rw-r--r--src/gui/painting/qprintengine_mac.mm41
-rw-r--r--src/gui/painting/qprinterinfo_mac.cpp10
-rw-r--r--src/gui/styles/qmacstyle_mac.mm213
-rw-r--r--src/gui/text/qfontengine_mac.mm14
-rw-r--r--src/gui/widgets/qmainwindowlayout_mac.mm18
-rw-r--r--src/gui/widgets/qstatusbar.cpp3
17 files changed, 228 insertions, 646 deletions
diff --git a/src/gui/accessible/qaccessible_mac.mm b/src/gui/accessible/qaccessible_mac.mm
index 65f9ab9..5646300 100644
--- a/src/gui/accessible/qaccessible_mac.mm
+++ b/src/gui/accessible/qaccessible_mac.mm
@@ -1232,10 +1232,8 @@ static int textForRoleAndAttribute(QAccessible::Role role, CFStringRef attribute
return QAccessible::Value;
else if (CFStringCompare(attribute, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo)
return QAccessible::Help;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
else if (CFStringCompare(attribute, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo)
return QAccessible::Description;
-#endif
else
return -1;
}
@@ -1442,17 +1440,13 @@ static OSStatus getAllAttributeNames(EventRef event, const QAInterface &interfac
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXRoleAttribute));
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXEnabledAttribute));
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXWindowAttribute));
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
qt_mac_append_cf_uniq(attrs, CFStringRef(QAXTopLevelUIElementAttribute));
-#endif
// Append these names if the QInterafceItem returns any data for them.
appendIfSupported(attrs, CFStringRef(QAXTitleAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXValueAttribute), interface);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
appendIfSupported(attrs, CFStringRef(QAXDescriptionAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXLinkedUIElementsAttribute), interface);
-#endif
appendIfSupported(attrs, CFStringRef(QAXHelpAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXTitleUIElementAttribute), interface);
appendIfSupported(attrs, CFStringRef(QAXChildrenAttribute), interface);
@@ -1705,12 +1699,10 @@ static OSStatus handleWindowAttribute(EventHandlerCallRef next_ref, EventRef eve
Returns the top-level window for an interface, which is the closest ancestor interface that
has the Window role. (Can also be a sheet or a drawer)
*/
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
static OSStatus handleTopLevelUIElementAttribute(EventHandlerCallRef next_ref, EventRef event, const QAInterface &interface)
{
return navigateAncestors<IsWindowTest>(next_ref, event, interface, CFStringRef(QAXTopLevelUIElementAttribute));
}
-#endif
/*
Returns the tab buttons for an interface.
@@ -1888,10 +1880,8 @@ static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event,
if (CFStringCompare(var, CFStringRef(QAXChildrenAttribute), 0) == kCFCompareEqualTo) {
return handleChildrenAttribute(next_ref, event, interface);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
} else if(CFStringCompare(var, CFStringRef(QAXTopLevelUIElementAttribute), 0) == kCFCompareEqualTo) {
return handleTopLevelUIElementAttribute(next_ref, event, interface);
-#endif
} else if(CFStringCompare(var, CFStringRef(QAXWindowAttribute), 0) == kCFCompareEqualTo) {
return handleWindowAttribute(next_ref, event, interface);
} else if(CFStringCompare(var, CFStringRef(QAXParentAttribute), 0) == kCFCompareEqualTo) {
@@ -1981,7 +1971,7 @@ static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event,
} else if (CFStringCompare(var, CFStringRef(QAXSubroleAttribute), 0) == kCFCompareEqualTo) {
return handleSubroleAttribute(next_ref, event, interface);
} else if (CFStringCompare(var, CFStringRef(QAXRoleDescriptionAttribute), 0) == kCFCompareEqualTo) {
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) && !defined(QT_MAC_USE_COCOA)
+#if !defined(QT_MAC_USE_COCOA)
if (HICopyAccessibilityRoleDescription) {
const CFStringRef roleDescription = HICopyAccessibilityRoleDescription(macRole(interface), 0);
SetEventParameter(event, kEventParamAccessibleAttributeValue, typeCFStringRef,
@@ -2005,14 +1995,12 @@ static OSStatus getNamedAttribute(EventHandlerCallRef next_ref, EventRef event,
} else {
handleStringAttribute(event, text, interface);
}
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
} else if (CFStringCompare(var, CFStringRef(QAXDescriptionAttribute), 0) == kCFCompareEqualTo) {
const QAccessible::Role role = interface.role();
const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
handleStringAttribute(event, text, interface);
} else if (CFStringCompare(var, CFStringRef(QAXLinkedUIElementsAttribute), 0) == kCFCompareEqualTo) {
return CallNextEventHandler(next_ref, event);
-#endif
} else if (CFStringCompare(var, CFStringRef(QAXHelpAttribute), 0) == kCFCompareEqualTo) {
const QAccessible::Role role = interface.role();
const QAccessible::Text text = (QAccessible::Text)textForRoleAndAttribute(role, var);
diff --git a/src/gui/dialogs/qwizard.cpp b/src/gui/dialogs/qwizard.cpp
index a2dfa52..3fdea54 100644
--- a/src/gui/dialogs/qwizard.cpp
+++ b/src/gui/dialogs/qwizard.cpp
@@ -1632,66 +1632,6 @@ void QWizardPrivate::setStyle(QStyle *style)
#ifdef Q_WS_MAC
-#ifdef Q_WS_MAC32
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <QuickTime/QuickTime.h>
-QT_END_INCLUDE_NAMESPACE
-typedef OSErr (*PtrQTNewDataReferenceFromCFURL)(CFURLRef, UInt32, Handle*, OSType*);
-typedef OSErr (*PtrGetGraphicsImporterForDataRefWithFlags)(Handle, OSType, ComponentInstance*, long);
-typedef ComponentResult (*PtrGraphicsImportSetFlags)(GraphicsImportComponent, long);
-typedef ComponentResult (*PtrGraphicsImportCreateCGImage)(GraphicsImportComponent, CGImageRef*, UInt32);
-
-static PtrQTNewDataReferenceFromCFURL ptrQTNewDataReferenceFromCFURL = 0;
-static PtrGetGraphicsImporterForDataRefWithFlags ptrGetGraphicsImporterForDataRefWithFlags = 0;
-static PtrGraphicsImportSetFlags ptrGraphicsImportSetFlags = 0;
-static PtrGraphicsImportCreateCGImage ptrGraphicsImportCreateCGImage = 0;
-
-static bool resolveQuickTimeSymbols()
-{
- if (ptrQTNewDataReferenceFromCFURL == 0) {
- QLibrary library(QLatin1String("/System/Library/Frameworks/QuickTime.framework/QuickTime"));
- ptrQTNewDataReferenceFromCFURL = reinterpret_cast<PtrQTNewDataReferenceFromCFURL>(library.resolve("QTNewDataReferenceFromCFURL"));
- ptrGetGraphicsImporterForDataRefWithFlags = reinterpret_cast<PtrGetGraphicsImporterForDataRefWithFlags>(library.resolve("GetGraphicsImporterForDataRefWithFlags"));
- ptrGraphicsImportSetFlags = reinterpret_cast<PtrGraphicsImportSetFlags>(library.resolve("GraphicsImportSetFlags"));
- ptrGraphicsImportCreateCGImage = reinterpret_cast<PtrGraphicsImportCreateCGImage>(library.resolve("GraphicsImportCreateCGImage"));
- }
-
- return ptrQTNewDataReferenceFromCFURL != 0 && ptrGetGraphicsImporterForDataRefWithFlags != 0
- && ptrGraphicsImportSetFlags != 0 && ptrGraphicsImportCreateCGImage != 0;
-}
-
-
-static QPixmap quicktimeTiff(const CFURLRef url)
-{
- if (!resolveQuickTimeSymbols())
- return QPixmap();
-
- QCFType <CGImageRef> imageRef = 0;
- Handle dataRef;
- OSType dataRefType;
- GraphicsImportComponent gi;
- ComponentResult result;
- result = ptrQTNewDataReferenceFromCFURL(url, 0, &dataRef, &dataRefType);
- if (dataRef != 0) {
- OSStatus err = ptrGetGraphicsImporterForDataRefWithFlags(dataRef, dataRefType, &gi, 0);
- if (err == noErr && gi) {
- result = ptrGraphicsImportSetFlags(gi, (kGraphicsImporterDontDoGammaCorrection
- + kGraphicsImporterDontUseColorMatching));
- if (!result)
- result = ptrGraphicsImportCreateCGImage(gi, &imageRef, 0);
- if (result)
- qWarning("Qt: Problem reading TIFF image %ld(%s:%d)", result, __FILE__, __LINE__);
- DisposeHandle(dataRef);
- CloseComponent(gi);
- }
- }
-
- if (imageRef)
- return QPixmap::fromMacCGImageRef(imageRef);
- return QPixmap();
-}
-#endif // Q_WS_MAC32
-
QPixmap QWizardPrivate::findDefaultBackgroundPixmap()
{
QCFType<CFURLRef> url;
@@ -1703,22 +1643,13 @@ QPixmap QWizardPrivate::findDefaultBackgroundPixmap()
if (bundle) {
url = CFBundleCopyResourceURL(bundle, CFSTR("Background"), CFSTR("tif"), 0);
if (url) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
- QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
- if (image) {
- int width = CGImageGetWidth(image);
- int height = CGImageGetHeight(image);
- if (width == ExpectedImageWidth && height == ExpectedImageHeight)
- return QPixmap::fromMacCGImageRef(image);
- }
- } else
-#endif
- {
-#ifdef Q_WS_MAC32
- return quicktimeTiff(url);
-#endif
+ QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithURL(url, 0);
+ QCFType<CGImageRef> image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
+ if (image) {
+ int width = CGImageGetWidth(image);
+ int height = CGImageGetHeight(image);
+ if (width == ExpectedImageWidth && height == ExpectedImageHeight)
+ return QPixmap::fromMacCGImageRef(image);
}
}
}
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index edae29a..fa407c7 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -54,7 +54,7 @@
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
-#include <Carbon/Carbon.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
#endif
QT_BEGIN_NAMESPACE
@@ -178,8 +178,8 @@ QPixmapIconEngine::~QPixmapIconEngine()
void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state)
{
QSize pixmapSize = rect.size();
-#if defined(Q_WS_MAC) && !defined(Q_WS_MAC64)
- pixmapSize *= (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) ? HIGetScaleFactor() : 1;
+#if defined(Q_WS_MAC)
+ pixmapSize *= qt_mac_get_scalefactor();
#endif
painter->drawPixmap(rect, pixmap(pixmapSize, mode, state));
}
diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp
index bfe5dfe..e3fb27a 100644
--- a/src/gui/image/qnativeimage.cpp
+++ b/src/gui/image/qnativeimage.cpp
@@ -236,8 +236,7 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /*
uint cgflags = kCGImageAlphaNoneSkipFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- cgflags |= kCGBitmapByteOrder32Host;
+ cgflags |= kCGBitmapByteOrder32Host;
#endif
cg = CGBitmapContextCreate(image.bits(), width, height, 8, image.bytesPerLine(), cgColorSpace, cgflags);
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp
index b40694a..c281fe9 100644
--- a/src/gui/image/qpixmap_mac.cpp
+++ b/src/gui/image/qpixmap_mac.cpp
@@ -119,14 +119,9 @@ CGImageRef qt_mac_image_to_cgimage(const QImage &image)
CGDataProviderCreateWithData(0, image.bits(), image.bytesPerLine() * image.height(),
0);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
uint cgflags = kCGImageAlphaPremultipliedFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- cgflags |= kCGBitmapByteOrder32Host;
-#endif
-#else
- CGImageAlphaInfo cgflags = kCGImageAlphaPremultipliedFirst;
+ cgflags |= kCGBitmapByteOrder32Host;
#endif
CGImageRef cgImage = CGImageCreate(image.width(), image.height(), bitsPerColor, bitsPerPixel,
@@ -645,14 +640,9 @@ void QMacPixmapData::macCreateCGImageRef()
pixels, bytesPerRow * h,
qt_mac_cgimage_data_free);
validDataPointers.insert(this);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
uint cgflags = kCGImageAlphaPremultipliedFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- cgflags |= kCGBitmapByteOrder32Host;
-#endif
-#else
- CGImageAlphaInfo cgflags = kCGImageAlphaPremultipliedFirst;
+ cgflags |= kCGBitmapByteOrder32Host;
#endif
cg_data = CGImageCreate(w, h, 8, 32, bytesPerRow, colorspace,
cgflags, provider, 0, 0, kCGRenderingIntentDefault);
@@ -893,38 +883,6 @@ static void qt_mac_grabDisplayRect(CGDirectDisplayID display, const QRect &displ
ptrCGLDestroyContext(glContextObj); // and destroy the context
}
-static CGImageRef qt_mac_createImageFromBitmapContext(CGContextRef c)
-{
- void *rasterData = CGBitmapContextGetData(c);
- const int width = CGBitmapContextGetBytesPerRow(c),
- height = CGBitmapContextGetHeight(c);
- size_t imageDataSize = width*height;
-
- if(!rasterData)
- return 0;
-
- // Create the data provider from the image data, using
- // the image releaser function releaseBitmapContextImageData.
- CGDataProviderRef dataProvider = CGDataProviderCreateWithData(0, rasterData,
- imageDataSize,
- qt_mac_cgimage_data_free);
-
- if(!dataProvider)
- return 0;
-
- uint bitmapInfo = 0;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if(CGBitmapContextGetBitmapInfo)
- bitmapInfo = CGBitmapContextGetBitmapInfo(c);
- else
-#endif
- bitmapInfo = CGBitmapContextGetAlphaInfo(c);
- return CGImageCreate(width, height, CGBitmapContextGetBitsPerComponent(c),
- CGBitmapContextGetBitsPerPixel(c), CGBitmapContextGetBytesPerRow(c),
- CGBitmapContextGetColorSpace(c), bitmapInfo, dataProvider,
- 0, true, kCGRenderingIntentDefault);
-}
-
// Returns a pixmap containing the screen contents at rect.
static QPixmap qt_mac_grabScreenRect(const QRect &rect)
{
@@ -958,19 +916,8 @@ static QPixmap qt_mac_grabScreenRect(const QRect &rect)
rect.height(), 8, bytewidth,
QCoreGraphicsPaintEngine::macGenericColorSpace(),
kCGImageAlphaNoneSkipFirst);
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QCFType<CGImageRef> image = CGBitmapContextCreateImage(bitmap);
- return QPixmap::fromMacCGImageRef(image);
- } else
-#endif
- {
- QCFType<CGImageRef> image = qt_mac_createImageFromBitmapContext(bitmap);
- if (!image)
- return QPixmap();
- return QPixmap::fromMacCGImageRef(image);
- }
+ QCFType<CGImageRef> image = CGBitmapContextCreateImage(bitmap);
+ return QPixmap::fromMacCGImageRef(image);
}
#ifndef QT_MAC_USE_COCOA // no QuickDraw in 64-bit mode
@@ -1043,18 +990,12 @@ Qt::HANDLE QPixmap::macQDHandle() const
SetRect(&rect, 0, 0, d->w, d->h);
unsigned long qdformat = k32ARGBPixelFormat;
GWorldFlags qdflags = 0;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- //we play such games so we can use the same buffer in CG as QD this
- //makes our merge much simpler, at some point the hacks will go away
- //because QD will be removed, but until that day this keeps them coexisting
- if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
- qdformat = k32BGRAPixelFormat;
-#if 0
- qdflags |= kNativeEndianPixMap;
-#endif
- }
-#endif
+ //we play such games so we can use the same buffer in CG as QD this
+ //makes our merge much simpler, at some point the hacks will go away
+ //because QD will be removed, but until that day this keeps them coexisting
+ if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
+ qdformat = k32BGRAPixelFormat;
+
if(NewGWorldFromPtr(&d->qd_data, qdformat, &rect, 0, 0, qdflags,
(char*)d->pixels, d->bytesPerRow) != noErr)
qWarning("Qt: internal: QPixmap::init error (%d %d %d %d)", rect.left, rect.top, rect.right, rect.bottom);
diff --git a/src/gui/kernel/qmime_mac.cpp b/src/gui/kernel/qmime_mac.cpp
index ebacc2f..31c66e4 100644
--- a/src/gui/kernel/qmime_mac.cpp
+++ b/src/gui/kernel/qmime_mac.cpp
@@ -68,11 +68,6 @@
#include "qmap.h"
#include <private/qt_mac_p.h>
-#ifdef Q_WS_MAC32
-#include <QuickTime/QuickTime.h>
-#include "qlibrary.h"
-#endif
-
QT_BEGIN_NAMESPACE
extern CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imagePtr = 0); // qpaintengine_mac.cpp
@@ -507,6 +502,9 @@ QList<QByteArray> QMacPasteboardMimeHTMLText::convertFromMime(const QString &mim
#ifdef Q_WS_MAC32
+#include <QuickTime/QuickTime.h>
+#include <qlibrary.h>
+
typedef ComponentResult (*PtrGraphicsImportSetDataHandle)(GraphicsImportComponent, Handle);
typedef ComponentResult (*PtrGraphicsImportCreateCGImage)(GraphicsImportComponent, CGImageRef*, UInt32);
typedef ComponentResult (*PtrGraphicsExportSetInputCGImage)(GraphicsExportComponent, CGImageRef);
@@ -684,33 +682,11 @@ QVariant QMacPasteboardMimeTiff::convertToMime(const QString &mime, QList<QByteA
return ret;
const QByteArray &a = data.first();
QCFType<CGImageRef> image;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QCFType<CFDataRef> data = CFDataCreateWithBytesNoCopy(0,
- reinterpret_cast<const UInt8 *>(a.constData()),
- a.size(), kCFAllocatorNull);
- QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithData(data, 0);
- image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
- } else
-#endif
- {
-#ifdef Q_WS_MAC32
- if (resolveMimeQuickTimeSymbols()) {
- Handle tiff = NewHandle(a.size());
- memcpy(*tiff, a.constData(), a.size());
- GraphicsImportComponent graphicsImporter;
- ComponentResult result = OpenADefaultComponent(GraphicsImporterComponentType,
- kQTFileTypeTIFF, &graphicsImporter);
- if (!result)
- result = ptrGraphicsImportSetDataHandle(graphicsImporter, tiff);
- if (!result)
- result = ptrGraphicsImportCreateCGImage(graphicsImporter, &image,
- kGraphicsImportCreateCGImageUsingCurrentSettings);
- CloseComponent(graphicsImporter);
- DisposeHandle(tiff);
- }
-#endif
- }
+ QCFType<CFDataRef> tiffData = CFDataCreateWithBytesNoCopy(0,
+ reinterpret_cast<const UInt8 *>(a.constData()),
+ a.size(), kCFAllocatorNull);
+ QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithData(tiffData, 0);
+ image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
if (image != 0)
ret = QVariant(QPixmap::fromMacCGImageRef(image).toImage());
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 5e5e0dc..f5f381e 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1166,4 +1166,13 @@ CGContextRef qt_mac_graphicsContextFor(QWidget *widget)
return context;
}
+CGFloat qt_mac_get_scalefactor()
+{
+#ifndef QT_MAC_USE_COCOA
+ return HIGetScaleFactor();
+#else
+ return [[NSScreen mainScreen] userSpaceScaleFactor];
+#endif
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 5156b9c..7b975f5 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -161,6 +161,8 @@ void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow);
+CGFloat qt_mac_get_scalefactor();
+
#ifdef __OBJC__
inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
{ return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); }
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index a75c2a3..88dc73f 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -505,16 +505,9 @@ static void qt_mac_release_window_group(WindowGroupRef group)
SInt32 qt_mac_get_group_level(WindowClass wclass)
{
SInt32 group_level;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- CGWindowLevel tmpLevel;
- GetWindowGroupLevelOfType(GetWindowGroupOfClass(wclass), kWindowGroupLevelActive, &tmpLevel);
- group_level = tmpLevel;
- } else
-#endif
- {
- GetWindowGroupLevel(GetWindowGroupOfClass(wclass), &group_level);
- }
+ CGWindowLevel tmpLevel;
+ GetWindowGroupLevelOfType(GetWindowGroupOfClass(wclass), kWindowGroupLevelActive, &tmpLevel);
+ group_level = tmpLevel;
return group_level;
}
#endif
@@ -736,11 +729,8 @@ static EventTypeSpec window_events[] = {
{ kEventClassWindow, kEventWindowProxyEndDrag },
{ kEventClassWindow, kEventWindowResizeCompleted },
{ kEventClassWindow, kEventWindowBoundsChanging },
- { kEventClassWindow, kEventWindowBoundsChanged },
{ kEventClassWindow, kEventWindowGetRegion },
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
{ kEventClassWindow, kEventWindowGetClickModality },
-#endif
{ kEventClassWindow, kEventWindowTransitionCompleted },
{ kEventClassMouse, kEventMouseDown }
};
@@ -770,7 +760,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
QWidget *widget = qt_mac_find_window(wid);
if(!widget) {
handled_event = false;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
} else if(ekind == kEventWindowGetClickModality) {
// Carbon will send us kEventWindowGetClickModality before every
// mouse press / release event. By returning 'true', we tell Carbon
@@ -781,7 +770,6 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
// By also setting the current modal window back into the event, we
// help Carbon determining which window is supposed to be raised.
handled_event = qApp->activePopupWidget() ? true : false;
-#endif
} else if(ekind == kEventWindowClose) {
widget->d_func()->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
QMenuBar::macUpdateMenuBar();
@@ -904,87 +892,78 @@ OSStatus QWidgetPrivate::qt_window_event(EventHandlerCallRef er, EventRef event,
SetEventParameter(mouseUpEvent, kEventParamMouseLocation, typeQDPoint, sizeof(pos), &pos);
SendEventToApplication(mouseUpEvent);
ReleaseEvent(mouseUpEvent);
- } else if(ekind == kEventWindowBoundsChanging || ekind == kEventWindowBoundsChanged) {
- // Panther doesn't send Changing for sheets, only changed, so only
- // bother handling Changed event if we are on 10.3 and we are a
- // sheet.
- if (ekind == kEventWindowBoundsChanged
- && (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4
- || !(widget->windowFlags() & Qt::Sheet))) {
- handled_event = false;
+ } else if(ekind == kEventWindowBoundsChanging) {
+ UInt32 flags = 0;
+ GetEventParameter(event, kEventParamAttributes, typeUInt32, 0,
+ sizeof(flags), 0, &flags);
+ Rect nr;
+ GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, 0,
+ sizeof(nr), 0, &nr);
+
+ QRect newRect(nr.left, nr.top, nr.right - nr.left, nr.bottom - nr.top);
+
+ QTLWExtra * const tlwExtra = widget->d_func()->maybeTopData();
+ if (tlwExtra && tlwExtra->isSetGeometry == 1) {
+ widget->d_func()->setGeometry_sys_helper(newRect.left(), newRect.top(), newRect.width(), newRect.height(), tlwExtra->isMove);
} else {
- UInt32 flags = 0;
- GetEventParameter(event, kEventParamAttributes, typeUInt32, 0,
- sizeof(flags), 0, &flags);
- Rect nr;
- GetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, 0,
- sizeof(nr), 0, &nr);
-
- QRect newRect(nr.left, nr.top, nr.right - nr.left, nr.bottom - nr.top);
-
- QTLWExtra * const tlwExtra = widget->d_func()->maybeTopData();
- if (tlwExtra && tlwExtra->isSetGeometry == 1) {
- widget->d_func()->setGeometry_sys_helper(newRect.left(), newRect.top(), newRect.width(), newRect.height(), tlwExtra->isMove);
- } else {
- //implicitly removes the maximized bit
- if((widget->data->window_state & Qt::WindowMaximized) &&
- IsWindowInStandardState(wid, 0, 0)) {
- widget->data->window_state &= ~Qt::WindowMaximized;
- QWindowStateChangeEvent e(Qt::WindowStates(widget->data->window_state
- | Qt::WindowMaximized));
- QApplication::sendSpontaneousEvent(widget, &e);
+ //implicitly removes the maximized bit
+ if((widget->data->window_state & Qt::WindowMaximized) &&
+ IsWindowInStandardState(wid, 0, 0)) {
+ widget->data->window_state &= ~Qt::WindowMaximized;
+ QWindowStateChangeEvent e(Qt::WindowStates(widget->data->window_state
+ | Qt::WindowMaximized));
+ QApplication::sendSpontaneousEvent(widget, &e);
- }
+ }
- handled_event = false;
- const QRect oldRect = widget->data->crect;
- if((flags & kWindowBoundsChangeOriginChanged)) {
- if(nr.left != oldRect.x() || nr.top != oldRect.y()) {
- widget->data->crect.moveTo(nr.left, nr.top);
- QMoveEvent qme(widget->data->crect.topLeft(), oldRect.topLeft());
- QApplication::sendSpontaneousEvent(widget, &qme);
- }
+ handled_event = false;
+ const QRect oldRect = widget->data->crect;
+ if((flags & kWindowBoundsChangeOriginChanged)) {
+ if(nr.left != oldRect.x() || nr.top != oldRect.y()) {
+ widget->data->crect.moveTo(nr.left, nr.top);
+ QMoveEvent qme(widget->data->crect.topLeft(), oldRect.topLeft());
+ QApplication::sendSpontaneousEvent(widget, &qme);
}
- if((flags & kWindowBoundsChangeSizeChanged)) {
- if (widget->isWindow()) {
- QSize newSize = QLayout::closestAcceptableSize(widget, newRect.size());
- int dh = newSize.height() - newRect.height();
- int dw = newSize.width() - newRect.width();
- if (dw != 0 || dh != 0) {
- handled_event = true; // We want to change the bounds, so we handle the event
-
- // set the rect, so we can also do the resize down below (yes, we need to resize).
- newRect.setBottom(newRect.bottom() + dh);
- newRect.setRight(newRect.right() + dw);
-
- nr.left = newRect.x();
- nr.top = newRect.y();
- nr.right = nr.left + newRect.width();
- nr.bottom = nr.top + newRect.height();
- SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), &nr);
- }
+ }
+ if((flags & kWindowBoundsChangeSizeChanged)) {
+ if (widget->isWindow()) {
+ QSize newSize = QLayout::closestAcceptableSize(widget, newRect.size());
+ int dh = newSize.height() - newRect.height();
+ int dw = newSize.width() - newRect.width();
+ if (dw != 0 || dh != 0) {
+ handled_event = true; // We want to change the bounds, so we handle the event
+
+ // set the rect, so we can also do the resize down below (yes, we need to resize).
+ newRect.setBottom(newRect.bottom() + dh);
+ newRect.setRight(newRect.right() + dw);
+
+ nr.left = newRect.x();
+ nr.top = newRect.y();
+ nr.right = nr.left + newRect.width();
+ nr.bottom = nr.top + newRect.height();
+ SetEventParameter(event, kEventParamCurrentBounds, typeQDRectangle, sizeof(Rect), &nr);
}
+ }
- if (oldRect.width() != newRect.width() || oldRect.height() != newRect.height()) {
- widget->data->crect.setSize(newRect.size());
- HIRect bounds = CGRectMake(0, 0, newRect.width(), newRect.height());
-
- // If the WA_StaticContents attribute is set we can optimize the resize
- // by only repainting the newly exposed area. We do this by disabling
- // painting when setting the size of the view. The OS will invalidate
- // the newly exposed area for us.
- const bool staticContents = widget->testAttribute(Qt::WA_StaticContents);
- const HIViewRef view = qt_mac_nativeview_for(widget);
- if (staticContents)
- HIViewSetDrawingEnabled(view, false);
- HIViewSetFrame(view, &bounds);
- if (staticContents)
- HIViewSetDrawingEnabled(view, true);
-
- QResizeEvent qre(newRect.size(), oldRect.size());
- QApplication::sendSpontaneousEvent(widget, &qre);
- qt_event_request_window_change(widget);
- }
+ if (oldRect.width() != newRect.width() || oldRect.height() != newRect.height()) {
+ widget->data->crect.setSize(newRect.size());
+ HIRect bounds = CGRectMake(0, 0, newRect.width(), newRect.height());
+
+ // If the WA_StaticContents attribute is set we can optimize the resize
+ // by only repainting the newly exposed area. We do this by disabling
+ // painting when setting the size of the view. The OS will invalidate
+ // the newly exposed area for us.
+ const bool staticContents = widget->testAttribute(Qt::WA_StaticContents);
+ const HIViewRef view = qt_mac_nativeview_for(widget);
+ if (staticContents)
+ HIViewSetDrawingEnabled(view, false);
+ HIViewSetFrame(view, &bounds);
+ if (staticContents)
+ HIViewSetDrawingEnabled(view, true);
+
+ QResizeEvent qre(newRect.size(), oldRect.size());
+ QApplication::sendSpontaneousEvent(widget, &qre);
+ qt_event_request_window_change(widget);
}
}
}
@@ -1703,17 +1682,11 @@ void QWidgetPrivate::determineWindowClass()
bool framelessWindow = (flags & Qt::FramelessWindowHint || (customize && !(flags & Qt::WindowTitleHint)));
if (framelessWindow) {
if(wclass == kDocumentWindowClass) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- wattr |= kWindowNoTitleBarAttribute;
- else
- wclass = kPlainWindowClass;
+ wattr |= kWindowNoTitleBarAttribute;
} else if(wclass == kFloatingWindowClass) {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- wattr |= kWindowNoTitleBarAttribute;
- else
- wclass = kToolbarWindowClass;
+ wattr |= kWindowNoTitleBarAttribute;
} else if (wclass == kMovableModalWindowClass) {
- wclass = kModalWindowClass;
+ wclass = kModalWindowClass;
}
} else {
if(wclass != kModalWindowClass)
@@ -2011,14 +1984,10 @@ void QWidgetPrivate::finishCreateWindow_sys_Carbon(OSWindowRef windowRef)
if (!desktop)
SetAutomaticControlDragTrackingEnabledForWindow(windowRef, true);
HIWindowChangeFeatures(windowRef, kWindowCanCollapse, 0);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- if (wattr & kWindowHideOnSuspendAttribute)
- HIWindowChangeAvailability(windowRef, kHIWindowExposeHidden, 0);
- else
- HIWindowChangeAvailability(windowRef, 0, kHIWindowExposeHidden);
- }
-#endif
+ if (wattr & kWindowHideOnSuspendAttribute)
+ HIWindowChangeAvailability(windowRef, kHIWindowExposeHidden, 0);
+ else
+ HIWindowChangeAvailability(windowRef, 0, kHIWindowExposeHidden);
if ((flags & Qt::WindowStaysOnTopHint))
ChangeWindowAttributes(windowRef, kWindowNoAttributes, kWindowHideOnSuspendAttribute);
if (qt_mac_is_macdrawer(q) && parentWidget)
@@ -2906,21 +2875,10 @@ void QWidgetPrivate::setWindowFilePath_sys(const QString &filePath)
}
// Set the proxy regardless, since this is our way of clearing it as well, but ignore the
// return value as well.
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- if (validRef) {
- status = HIWindowSetProxyFSRef(qt_mac_window_for(q), &ref);
- } else {
- status = RemoveWindowProxy(qt_mac_window_for(q));
- }
+ if (validRef) {
+ status = HIWindowSetProxyFSRef(qt_mac_window_for(q), &ref);
} else {
- // Convert to an FSSpec and set it. It's deprecated but it works for where we don't have the other call.
- if (validRef) {
- FSSpec fsspec;
- FSGetCatalogInfo(&ref, kFSCatInfoNone, 0, 0, &fsspec, 0);
- status = SetWindowProxyFSSpec(qt_mac_window_for(q), &fsspec);
- } else {
- status = RemoveWindowProxy(qt_mac_window_for(q));
- }
+ status = RemoveWindowProxy(qt_mac_window_for(q));
}
if (status != noErr)
qWarning("QWidget::setWindowFilePath: Error setting proxyicon for path (%s):%ld",
@@ -3128,16 +3086,9 @@ void QWidgetPrivate::update_sys(const QRect &r)
if (updateRedirectedToGraphicsProxyWidget(q, updateRect))
return;
#ifndef QT_MAC_USE_COCOA
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- dirtyOnWidget += updateRect;
- HIRect r = CGRectMake(x, y, w, h);
- HIViewSetNeedsDisplayInRect(qt_mac_nativeview_for(q), &r, true);
- } else
- #endif
- {
- q->update(QRegion(updateRect));
- }
+ dirtyOnWidget += updateRect;
+ HIRect r = CGRectMake(x, y, w, h);
+ HIViewSetNeedsDisplayInRect(qt_mac_nativeview_for(q), &r, true);
#else
[qt_mac_nativeview_for(q) setNeedsDisplayInRect:NSMakeRect(x, y, w, h)];
#endif
@@ -4294,32 +4245,14 @@ void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &r)
OSViewRef view = qt_mac_nativeview_for(q);
#ifndef QT_MAC_USE_COCOA
HIRect scrollrect = CGRectMake(r.x(), r.y(), r.width(), r.height());
-# if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- OSStatus err = _HIViewScrollRectWithOptions(view, valid_rect ? &scrollrect : 0, dx, dy, kHIViewScrollRectAdjustInvalid);
- if (err) {
- // The only parameter that can go wrong, is the rect.
- qWarning("QWidget::scroll: Your rectangle was too big for the widget, clipping rect");
- scrollrect = CGRectMake(qMax(r.x(), 0), qMax(r.y(), 0),
- qMin(r.width(), q->width()), qMin(r.height(), q->height()));
- _HIViewScrollRectWithOptions(view, valid_rect ? &scrollrect : 0, dx, dy, kHIViewScrollRectAdjustInvalid);
- }
- } else {
- if (HIViewGetNeedsDisplay(view)) {
- q->update(valid_rect ? r : q->rect());
- return;
- }
- HIRect scrollrect = CGRectMake(r.x(), r.y(), r.width(), r.height());
- OSStatus err = HIViewScrollRect(view, valid_rect ? &scrollrect : 0, dx, dy);
- if (err) {
- // The only parameter that can go wrong, is the rect.
- qWarning("QWidget::scroll: Your rectangle was too big for the widget, clipping rect");
- scrollrect = CGRectMake(qMax(r.x(), 0), qMax(r.y(), 0),
- qMin(r.width(), q->width()), qMin(r.height(), q->height()));
- HIViewScrollRect(view, valid_rect ? &scrollrect : 0, dx, dy);
- }
+ OSStatus err = _HIViewScrollRectWithOptions(view, valid_rect ? &scrollrect : 0, dx, dy, kHIViewScrollRectAdjustInvalid);
+ if (err) {
+ // The only parameter that can go wrong, is the rect.
+ qWarning("QWidget::scroll: Your rectangle was too big for the widget, clipping rect");
+ scrollrect = CGRectMake(qMax(r.x(), 0), qMax(r.y(), 0),
+ qMin(r.width(), q->width()), qMin(r.height(), q->height()));
+ _HIViewScrollRectWithOptions(view, valid_rect ? &scrollrect : 0, dx, dy, kHIViewScrollRectAdjustInvalid);
}
-# endif
#else
NSRect scrollRect = valid_rect ? NSMakeRect(r.x(), r.y(), r.width(), r.height())
: NSMakeRect(0, 0, q->width(), q->height());
@@ -4860,11 +4793,9 @@ void QWidgetPrivate::macUpdateMetalAttribute()
if (layout)
layout->updateHIToolBarStatus();
ChangeWindowAttributes(qt_mac_window_for(q), kWindowMetalAttribute, 0);
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- ChangeWindowAttributes(qt_mac_window_for(q), kWindowMetalNoContentSeparatorAttribute, 0);
+ ChangeWindowAttributes(qt_mac_window_for(q), kWindowMetalNoContentSeparatorAttribute, 0);
} else {
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- ChangeWindowAttributes(qt_mac_window_for(q), 0, kWindowMetalNoContentSeparatorAttribute);
+ ChangeWindowAttributes(qt_mac_window_for(q), 0, kWindowMetalNoContentSeparatorAttribute);
ChangeWindowAttributes(qt_mac_window_for(q), 0, kWindowMetalAttribute);
if (layout)
layout->updateHIToolBarStatus();
diff --git a/src/gui/painting/qpaintdevice_mac.cpp b/src/gui/painting/qpaintdevice_mac.cpp
index 92ca52d..7de56ac 100644
--- a/src/gui/painting/qpaintdevice_mac.cpp
+++ b/src/gui/painting/qpaintdevice_mac.cpp
@@ -142,14 +142,9 @@ Q_GUI_EXPORT CGContextRef qt_mac_cg_context(const QPaintDevice *pdev)
if (pdev->devType() == QInternal::Pixmap) {
const QPixmap *pm = static_cast<const QPixmap*>(pdev);
CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
uint flags = kCGImageAlphaPremultipliedFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- flags |= kCGBitmapByteOrder32Host;
-#endif
-#else
- CGImageAlphaInfo flags = kCGImageAlphaPremultipliedFirst;
+ flags |= kCGBitmapByteOrder32Host;
#endif
CGContextRef ret = 0;
diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp
index 282cce8..793460f 100644
--- a/src/gui/painting/qpaintengine_mac.cpp
+++ b/src/gui/painting/qpaintengine_mac.cpp
@@ -102,14 +102,9 @@ QMacCGContext::QMacCGContext(QPainter *p)
extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice());
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
uint flags = kCGImageAlphaPremultipliedFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- flags |= kCGBitmapByteOrder32Host;
-#endif
-#else
- CGImageAlphaInfo flags = kCGImageAlphaPremultipliedFirst;
+ flags |= kCGBitmapByteOrder32Host;
#endif
const QImage *image = (const QImage *) pe->paintDevice();
@@ -528,23 +523,12 @@ static void qt_mac_dispose_pattern(void *info)
inline static QPaintEngine::PaintEngineFeatures qt_mac_cg_features()
{
- QPaintEngine::PaintEngineFeatures ret(QPaintEngine::AllFeatures
- & ~QPaintEngine::PaintOutsidePaintEvent
- & ~QPaintEngine::PerspectiveTransform
- & ~QPaintEngine::ConicalGradientFill
- & ~QPaintEngine::LinearGradientFill
- & ~QPaintEngine::RadialGradientFill
- & ~QPaintEngine::BrushStroke);
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- ;
- } else
-#endif
- {
- ret &= ~QPaintEngine::BlendModes;
- }
- return ret;
+ return QPaintEngine::PaintEngineFeatures(QPaintEngine::AllFeatures & ~QPaintEngine::PaintOutsidePaintEvent
+ & ~QPaintEngine::PerspectiveTransform
+ & ~QPaintEngine::ConicalGradientFill
+ & ~QPaintEngine::LinearGradientFill
+ & ~QPaintEngine::RadialGradientFill
+ & ~QPaintEngine::BrushStroke);
}
QCoreGraphicsPaintEngine::QCoreGraphicsPaintEngine()
@@ -994,22 +978,8 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co
CGContextSetFillColorWithColor(d->hd, cgColorForQColor(col, d->pdev));
image = qt_mac_create_imagemask(pm, sr);
} else if (differentSize) {
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QCFType<CGImageRef> img = pm.toMacCGImageRef();
- image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height())));
- } else
-#endif
- {
- const int sx = qRound(sr.x()), sy = qRound(sr.y()), sw = qRound(sr.width()), sh = qRound(sr.height());
- const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm.data);
- quint32 *pantherData = pmData->pixels + sy * (pmData->bytesPerRow / 4) + sx;
- QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, pantherData, sw*sh*pmData->bytesPerRow, 0);
- image = CGImageCreate(sw, sh, 8, 32, pmData->bytesPerRow,
- macGenericColorSpace(),
- kCGImageAlphaPremultipliedFirst, provider, 0, 0,
- kCGRenderingIntentDefault);
- }
+ QCFType<CGImageRef> img = pm.toMacCGImageRef();
+ image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height())));
} else {
image = (CGImageRef)pm.macCGHandle();
}
@@ -1031,11 +1001,7 @@ CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imag
else
image = new QImage(img);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
uint cgflags = kCGImageAlphaNone;
-#else
- CGImageAlphaInfo cgflags = kCGImageAlphaNone;
-#endif
switch (image->format()) {
case QImage::Format_ARGB32_Premultiplied:
cgflags = kCGImageAlphaPremultipliedFirst;
@@ -1048,9 +1014,8 @@ CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imag
default:
break;
}
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) && defined(kCGBitmapByteOrder32Host) //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- cgflags |= kCGBitmapByteOrder32Host;
+#if defined(kCGBitmapByteOrder32Host) //only needed because CGImage.h added symbols in the minor version
+ cgflags |= kCGBitmapByteOrder32Host;
#endif
QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(image,
static_cast<const QImage *>(image)->bits(),
@@ -1078,27 +1043,9 @@ void QCoreGraphicsPaintEngine::drawImage(const QRectF &r, const QImage &img, con
const QImage *image;
QCFType<CGImageRef> cgimage = qt_mac_createCGImageFromQImage(img, &image);
CGRect rect = CGRectMake(r.x(), r.y(), r.width(), r.height());
- if (QRectF(0, 0, img.width(), img.height()) != sr) {
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- cgimage = CGImageCreateWithImageInRect(cgimage, CGRectMake(sr.x(), sr.y(),
- sr.width(), sr.height()));
- } else
-#endif
- {
- int sx = qRound(sr.x());
- int sy = qRound(sr.y());
- int sw = qRound(sr.width());
- int sh = qRound(sr.height());
- // Make another CGImage based on the part that we need.
- const uchar *pantherData = image->scanLine(sy) + sx * sizeof(uint);
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(0, pantherData,
- sw * sh * image->bytesPerLine(), 0);
- cgimage = CGImageCreate(sw, sh, 8, 32, image->bytesPerLine(),
- macGenericColorSpace(),
- CGImageGetAlphaInfo(cgimage), dataProvider, 0, false, kCGRenderingIntentDefault);
- }
- }
+ if (QRectF(0, 0, img.width(), img.height()) != sr)
+ cgimage = CGImageCreateWithImageInRect(cgimage, CGRectMake(sr.x(), sr.y(),
+ sr.width(), sr.height()));
qt_mac_drawCGImage(d->hd, &rect, cgimage);
}
diff --git a/src/gui/painting/qprintengine_mac.mm b/src/gui/painting/qprintengine_mac.mm
index 255a0a1..1c4505f 100644
--- a/src/gui/painting/qprintengine_mac.mm
+++ b/src/gui/painting/qprintengine_mac.mm
@@ -92,16 +92,8 @@ bool QMacPrintEngine::begin(QPaintDevice *dev)
}
OSStatus status = noErr;
#ifndef QT_MAC_USE_COCOA
-# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- status = d->shouldSuppressStatus() ? PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format)
- : PMSessionBeginCGDocument(d->session, d->settings, d->format);
- } else
-# endif
- {
- status = d->shouldSuppressStatus() ? PMSessionBeginDocumentNoDialog(d->session, d->settings, d->format)
- : PMSessionBeginDocument(d->session, d->settings, d->format);
- }
+ status = d->shouldSuppressStatus() ? PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format)
+ : PMSessionBeginCGDocument(d->session, d->settings, d->format);
#else
status = PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format);
#endif
@@ -468,23 +460,6 @@ void QMacPrintEnginePrivate::initialize()
#endif
#ifndef QT_MAC_USE_COCOA
-# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_4)
-# endif
- {
- if(paintEngine->type() == QPaintEngine::CoreGraphics) {
- CFStringRef strings[1] = { kPMGraphicsContextCoreGraphics };
- QCFType<CFArrayRef> contextArray = CFArrayCreate(kCFAllocatorDefault,
- reinterpret_cast<const void **>(strings),
- 1, &kCFTypeArrayCallBacks);
- OSStatus err = PMSessionSetDocumentFormatGeneration(session, kPMDocumentFormatPDF,
- contextArray, 0);
- if(err != noErr) {
- qWarning("QMacPrintEngine::initialize: Cannot set format generation to PDF: %ld", err);
- state = QPrinter::Error;
- }
- }
- }
if (!settingsOK || !formatOK) {
qWarning("QMacPrintEngine::initialize: Unable to initialize QPainter");
state = QPrinter::Error;
@@ -551,19 +526,7 @@ bool QMacPrintEnginePrivate::newPage_helper()
CGContextRef cgContext;
OSStatus err = noErr;
-#ifndef QT_MAC_USE_COCOA
-# if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- err = PMSessionGetCGGraphicsContext(session, &cgContext);
- } else
-# endif
- {
- err = PMSessionGetGraphicsContext(session, kPMGraphicsContextCoreGraphics,
- reinterpret_cast<void **>(&cgContext));
- }
-#else
err = PMSessionGetCGGraphicsContext(session, &cgContext);
-#endif
if(err != noErr) {
qWarning("QMacPrintEngine::newPage: Cannot retrieve CoreGraphics context: %ld", long(err));
state = QPrinter::Error;
diff --git a/src/gui/painting/qprinterinfo_mac.cpp b/src/gui/painting/qprinterinfo_mac.cpp
index 9cf94b2..c84271c 100644
--- a/src/gui/painting/qprinterinfo_mac.cpp
+++ b/src/gui/painting/qprinterinfo_mac.cpp
@@ -172,16 +172,9 @@ bool QPrinterInfo::isDefault() const
QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_4)
- return QList<QPrinter::PaperSize>();
-#else
- if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4)
- return QList<QPrinter::PaperSize>();
-
const Q_D(QPrinterInfo);
- PMPrinter cfPrn = PMPrinterCreateFromPrinterID(
- QCFString::toCFStringRef(d->m_name));
+ PMPrinter cfPrn = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(d->m_name));
if (!cfPrn) return QList<QPrinter::PaperSize>();
@@ -211,7 +204,6 @@ QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
PMRelease(cfPrn);
return paperList;
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED
}
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index d50cd42..8812614 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -581,11 +581,7 @@ QPixmap *qt_mac_backgroundPattern = 0; // stores the standard widget background.
*****************************************************************************/
static inline int qt_mac_hitheme_tab_version()
{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- return 1;
-#endif
- return 0;
+ return 1;
}
static inline HIRect qt_hirectForQRect(const QRect &convertRect, const QRect &rect = QRect())
@@ -1471,8 +1467,7 @@ void QMacStylePrivate::getSliderInfo(QStyle::ComplexControl cc, const QStyleOpti
}
// Tiger broke reverse scroll bars so put them back and "fake it"
- if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)
- && QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
+ if (isScrollbar && (tdi->attributes & kThemeTrackRightToLeft)) {
tdi->attributes &= ~kThemeTrackRightToLeft;
tdi->value = tdi->max - slider->sliderPosition;
}
@@ -2027,22 +2022,10 @@ QMacStyle::~QMacStyle()
QPixmap QMacStylePrivate::generateBackgroundPattern() const
{
QPixmap px(4, 4);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QMacCGContext cg(&px);
- HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal);
- const CGRect cgRect = CGRectMake(0, 0, px.width(), px.height());
- CGContextFillRect(cg, cgRect);
- } else
-#endif
- {
-#ifndef QT_MAC_NO_QUICKDRAW
- QMacSavedPortInfo port(&px);
- SetThemeBackground(kThemeBrushDialogBackgroundActive, px.depth(), true);
- const Rect qdRect = { 0, 0, px.width(), px.height() };
- EraseRect(&qdRect);
-#endif
- }
+ QMacCGContext cg(&px);
+ HIThemeSetFill(kThemeBrushDialogBackgroundActive, 0, cg, kHIThemeOrientationNormal);
+ const CGRect cgRect = CGRectMake(0, 0, px.width(), px.height());
+ CGContextFillRect(cg, cgRect);
return px;
}
@@ -2052,14 +2035,13 @@ QPixmap QMacStylePrivate::generateBackgroundPattern() const
*/
void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush)
{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
QPoint dummy;
const QPaintDevice *target = painter->device();
const QPaintDevice *redirected = QPainter::redirected(target, &dummy);
const bool usePainter = redirected && redirected != target;
const QRegion translated = rgn.translated(offset);
- if (!usePainter && QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4 && qt_mac_backgroundPattern
+ if (!usePainter && qt_mac_backgroundPattern
&& qt_mac_backgroundPattern->cacheKey() == brush.texture().cacheKey()) {
painter->setClipRegion(translated);
@@ -2078,9 +2060,7 @@ void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint
}
CGContextRestoreGState(cg);
- } else
-#endif
- {
+ } else {
const QRect rect(translated.boundingRect());
painter->setClipRegion(translated);
painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
@@ -3318,27 +3298,14 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
if (const QStyleOptionTabWidgetFrame *twf
= qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
HIRect hirect = qt_hirectForQRect(twf->rect);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- HIThemeTabPaneDrawInfo tpdi;
- tpdi.version = qt_mac_hitheme_tab_version();
- tpdi.state = tds;
- tpdi.direction = getTabDirection(twf->shape);
- tpdi.size = kHIThemeTabSizeNormal;
- if (tpdi.version == 1) {
- tpdi.kind = kHIThemeTabKindNormal;
- tpdi.adornment = kHIThemeTabPaneAdornmentNormal;
- }
- HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
- } else
-#endif
- {
- HIThemeGroupBoxDrawInfo gdi;
- gdi.version = qt_mac_hitheme_version;
- gdi.state = tds;
- gdi.kind = kHIThemeGroupBoxKindSecondary;
- HIThemeDrawGroupBox(&hirect, &gdi, cg, kHIThemeOrientationNormal);
- }
+ HIThemeTabPaneDrawInfo tpdi;
+ tpdi.version = qt_mac_hitheme_tab_version();
+ tpdi.state = tds;
+ tpdi.direction = getTabDirection(twf->shape);
+ tpdi.size = kHIThemeTabSizeNormal;
+ tpdi.kind = kHIThemeTabKindNormal;
+ tpdi.adornment = kHIThemeTabPaneAdornmentNormal;
+ HIThemeDrawTabPane(&hirect, &tpdi, cg, kHIThemeOrientationNormal);
}
break;
case PE_PanelScrollAreaCorner: {
@@ -3358,11 +3325,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
drawTabCloseButton(p, hover, active, selected);
} break;
case PE_PanelStatusBar: {
- if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) {
- QWindowsStyle::drawPrimitive(pe, opt, p, w);
- break;
- }
-
// Use the Leopard style only if the status bar is the status bar for a
// QMainWindow with a unifed toolbar.
if (w == 0 || w->parent() == 0 || qobject_cast<QMainWindow *>(w->parent()) == 0 ||
@@ -4812,10 +4774,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
// similar when I have an upside down scroll bar
// because on Tiger I only "fake" the reverse stuff.
bool reverseHorizontal = (slider->direction == Qt::RightToLeft
- && slider->orientation == Qt::Horizontal
- && (!slider->upsideDown
- || (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4
- && slider->upsideDown)));
+ && slider->orientation == Qt::Horizontal);
if ((reverseHorizontal
&& slider->activeSubControls == SC_ScrollBarAddLine)
|| (!reverseHorizontal
@@ -5450,11 +5409,7 @@ QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *op
cpc = sc == SC_ScrollBarSubLine ? kControlUpButtonPart
: kControlDownButtonPart;
if (slider->direction == Qt::RightToLeft
- && slider->orientation == Qt::Horizontal
- && (!slider->upsideDown
- || (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4
- && slider->upsideDown))
- ) {
+ && slider->orientation == Qt::Horizontal) {
if (cpc == kControlDownButtonPart)
cpc = kControlUpButtonPart;
else if (cpc == kControlUpButtonPart)
@@ -5772,11 +5727,6 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
break;
case QStyle::CT_TabBarTab:
if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
- bool newStyleTabs =
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4 ? true :
-#endif
- false;
const QAquaWidgetSize AquaSize = d->aquaSizeConstrain(opt, widget);
const bool differentFont = (widget && widget->testAttribute(Qt::WA_SetFont))
|| !QApplication::desktopSettingsAware();
@@ -5784,86 +5734,61 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
bool vertTabs = ttd == kThemeTabWest || ttd == kThemeTabEast;
if (vertTabs)
sz.transpose();
- if (newStyleTabs) {
- int defaultTabHeight;
- int defaultExtraSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK)
- QFontMetrics fm = opt->fontMetrics;
- switch (AquaSize) {
- case QAquaSizeUnknown:
- case QAquaSizeLarge:
- if (tab->documentMode)
- defaultTabHeight = 23;
- else
- defaultTabHeight = 21;
- break;
- case QAquaSizeSmall:
- defaultTabHeight = 18;
- break;
- case QAquaSizeMini:
- defaultTabHeight = 16;
- break;
- }
-
- bool setWidth = false;
- if (differentFont || !tab->icon.isNull()) {
- sz.rheight() = qMax(defaultTabHeight, sz.height());
- } else {
- QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
- sz.rheight() = qMax(defaultTabHeight, textSize.height());
- sz.rwidth() = textSize.width() + defaultExtraSpace;
- setWidth = true;
- }
+ int defaultTabHeight;
+ int defaultExtraSpace = proxy()->pixelMetric(PM_TabBarTabHSpace, tab, widget); // Remove spurious gcc warning (AFAIK)
+ QFontMetrics fm = opt->fontMetrics;
+ switch (AquaSize) {
+ case QAquaSizeUnknown:
+ case QAquaSizeLarge:
+ if (tab->documentMode)
+ defaultTabHeight = 23;
+ else
+ defaultTabHeight = 21;
+ break;
+ case QAquaSizeSmall:
+ defaultTabHeight = 18;
+ break;
+ case QAquaSizeMini:
+ defaultTabHeight = 16;
+ break;
+ }
+ bool setWidth = false;
+ if (differentFont || !tab->icon.isNull()) {
+ sz.rheight() = qMax(defaultTabHeight, sz.height());
+ } else {
+ QSize textSize = fm.size(Qt::TextShowMnemonic, tab->text);
+ sz.rheight() = qMax(defaultTabHeight, textSize.height());
+ sz.rwidth() = textSize.width() + defaultExtraSpace;
+ setWidth = true;
+ }
- if (vertTabs)
- sz.transpose();
+ if (vertTabs)
+ sz.transpose();
- int maxWidgetHeight = qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
- int maxWidgetWidth = qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
+ int maxWidgetHeight = qMax(tab->leftButtonSize.height(), tab->rightButtonSize.height());
+ int maxWidgetWidth = qMax(tab->leftButtonSize.width(), tab->rightButtonSize.width());
- int widgetWidth = 0;
- int widgetHeight = 0;
- int padding = 0;
- if (tab->leftButtonSize.isValid()) {
- padding += 8;
- widgetWidth += tab->leftButtonSize.width();
- widgetHeight += tab->leftButtonSize.height();
- }
- if (tab->rightButtonSize.isValid()) {
- padding += 8;
- widgetWidth += tab->rightButtonSize.width();
- widgetHeight += tab->rightButtonSize.height();
- }
+ int widgetWidth = 0;
+ int widgetHeight = 0;
+ int padding = 0;
+ if (tab->leftButtonSize.isValid()) {
+ padding += 8;
+ widgetWidth += tab->leftButtonSize.width();
+ widgetHeight += tab->leftButtonSize.height();
+ }
+ if (tab->rightButtonSize.isValid()) {
+ padding += 8;
+ widgetWidth += tab->rightButtonSize.width();
+ widgetHeight += tab->rightButtonSize.height();
+ }
- if (vertTabs) {
- sz.setHeight(sz.height() + widgetHeight + padding);
- sz.setWidth(qMax(sz.width(), maxWidgetWidth));
- } else {
- if (setWidth)
- sz.setWidth(sz.width() + widgetWidth + padding);
- sz.setHeight(qMax(sz.height(), maxWidgetHeight));
- }
+ if (vertTabs) {
+ sz.setHeight(sz.height() + widgetHeight + padding);
+ sz.setWidth(qMax(sz.width(), maxWidgetWidth));
} else {
- SInt32 tabh = sz.height();
- SInt32 overlap = 0;
- switch (AquaSize) {
- default:
- case QAquaSizeUnknown:
- case QAquaSizeLarge:
- GetThemeMetric(kThemeLargeTabHeight, &tabh);
- GetThemeMetric(kThemeMetricTabFrameOverlap, &overlap);
- break;
- case QAquaSizeMini:
- GetThemeMetric(kThemeMetricMiniTabHeight, &tabh);
- GetThemeMetric(kThemeMetricMiniTabFrameOverlap, &overlap);
- break;
- case QAquaSizeSmall:
- GetThemeMetric(kThemeSmallTabHeight, &tabh);
- GetThemeMetric(kThemeMetricSmallTabFrameOverlap, &overlap);
- break;
- }
- tabh += overlap;
- if (sz.height() < tabh)
- sz.rheight() = tabh;
+ if (setWidth)
+ sz.setWidth(sz.width() + widgetWidth + padding);
+ sz.setHeight(qMax(sz.height(), maxWidgetHeight));
}
}
break;
@@ -6152,11 +6077,9 @@ QIcon QMacStyle::standardIconImplementation(StandardPixmap standardIcon, const Q
case SP_TrashIcon:
iconType = kTrashIcon;
break;
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
case SP_ComputerIcon:
iconType = kComputerIcon;
break;
-#endif
case SP_DriveFDIcon:
iconType = kGenericFloppyIcon;
break;
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index a545148..76132df 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -540,14 +540,9 @@ QImage QCoreTextFontEngine::alphaMapForGlyph(glyph_t glyph)
im.fill(0);
CGColorSpaceRef colorspace = QCoreGraphicsPaintEngine::macGenericColorSpace();
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
uint cgflags = kCGImageAlphaNoneSkipFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- cgflags |= kCGBitmapByteOrder32Host;
-#endif
-#else
- CGImageAlphaInfo cgflags = kCGImageAlphaNoneSkipFirst;
+ cgflags |= kCGBitmapByteOrder32Host;
#endif
CGContextRef ctx = CGBitmapContextCreate(im.bits(), im.width(), im.height(),
8, im.bytesPerLine(), colorspace,
@@ -1431,14 +1426,9 @@ QImage QFontEngineMac::imageForGlyph(glyph_t glyph, int margin, bool colorful)
im.fill(0xff000000);
CGColorSpaceRef colorspace = QCoreGraphicsPaintEngine::macGenericColorSpace();
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
uint cgflags = kCGImageAlphaNoneSkipFirst;
#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- if(QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4)
- cgflags |= kCGBitmapByteOrder32Host;
-#endif
-#else
- CGImageAlphaInfo cgflags = kCGImageAlphaNoneSkipFirst;
+ cgflags |= kCGBitmapByteOrder32Host;
#endif
CGContextRef ctx = CGBitmapContextCreate(im.bits(), im.width(), im.height(),
8, im.bytesPerLine(), colorspace,
diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm
index 03bae2f..6632be7 100644
--- a/src/gui/widgets/qmainwindowlayout_mac.mm
+++ b/src/gui/widgets/qmainwindowlayout_mac.mm
@@ -329,18 +329,16 @@ OSStatus QMainWindowLayout::qtmacToolbarDelegate(EventHandlerCallRef, EventRef e
void QMainWindowLayout::updateHIToolBarStatus()
{
bool useMacToolbar = layoutState.mainWindow->unifiedTitleAndToolBarOnMac();
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
#ifndef QT_MAC_USE_COCOA
- if (useMacToolbar) {
- ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow),
- kWindowUnifiedTitleAndToolbarAttribute, 0);
- } else {
- ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow),
- 0, kWindowUnifiedTitleAndToolbarAttribute);
- }
-#endif
- macWindowToolbarShow(layoutState.mainWindow, useMacToolbar);
+ if (useMacToolbar) {
+ ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow),
+ kWindowUnifiedTitleAndToolbarAttribute, 0);
+ } else {
+ ChangeWindowAttributes(qt_mac_window_for(layoutState.mainWindow),
+ 0, kWindowUnifiedTitleAndToolbarAttribute);
}
+#endif
+ macWindowToolbarShow(layoutState.mainWindow, useMacToolbar);
layoutState.mainWindow->setUpdatesEnabled(false); // reduces a little bit of flicker, not all though
if (!useMacToolbar) {
diff --git a/src/gui/widgets/qstatusbar.cpp b/src/gui/widgets/qstatusbar.cpp
index da70aac..8a174f9 100644
--- a/src/gui/widgets/qstatusbar.cpp
+++ b/src/gui/widgets/qstatusbar.cpp
@@ -804,9 +804,6 @@ bool QStatusBar::event(QEvent *e)
#ifndef Q_WS_MAC
return QWidget::event(e);
#else
- if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4)
- return QWidget::event(e);
-
// Enable drag-click only if the status bar is the status bar for a
// QMainWindow with a unifed toolbar.
if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 ||