44 #include <QtGui/QWindowSystemInterface> 46 #include <QtCore/QDebug> 74 int bitDepth = image->
depth();
75 int colorBufferSize = 8;
77 int width = image->
width();
78 int height = image->
height();
82 CGDataProviderRef cgDataProviderRef = CGDataProviderCreateWithData(
98 kCGRenderingIntentDefault);
100 CGColorSpaceRelease(cgColourSpaceRef);
104 - (void) drawRect:(NSRect)dirtyRect
109 CGRect dirtyCGRect = NSRectToCGRect(dirtyRect);
111 NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext currentContext];
114 CGContextSaveGState( cgContext );
115 int dy = dirtyCGRect.origin.y + CGRectGetMaxY(dirtyCGRect);
116 CGContextTranslateCTM(cgContext, 0, dy);
117 CGContextScaleCTM(cgContext, 1, -1);
120 CGContextDrawImage(cgContext,dirtyCGRect,subImage);
122 CGContextRestoreGState(cgContext);
124 CGImageRelease(subImage);
133 - (void)handleMouseEvent:(NSEvent *)theEvent;
135 NSPoint point = [
self convertPoint: [theEvent locationInWindow] fromView: nil];
136 QPoint qt_localPoint(point.x,point.y);
138 NSTimeInterval timestamp = [theEvent timestamp];
139 ulong qt_timestamp = timestamp * 1000;
144 - (void)mouseDown:(NSEvent *)theEvent
149 - (void)mouseDragged:(NSEvent *)theEvent
152 qWarning(
"Internal Mousebutton tracking invalid(missing Qt::LeftButton");
155 - (void)mouseUp:(NSEvent *)theEvent
161 - (void)mouseMoved:(NSEvent *)theEvent
166 - (void)mouseEntered:(NSEvent *)theEvent
171 - (void)mouseExited:(NSEvent *)theEvent
176 - (void)rightMouseDown:(NSEvent *)theEvent
181 - (void)rightMouseDragged:(NSEvent *)theEvent
184 qWarning(
"Internal Mousebutton tracking invalid(missing Qt::LeftButton");
187 - (void)rightMouseUp:(NSEvent *)theEvent
192 - (void)otherMouseDown:(NSEvent *)theEvent
197 - (void)otherMouseDragged:(NSEvent *)theEvent
200 qWarning(
"Internal Mousebutton tracking invalid(missing Qt::LeftButton");
203 - (void)otherMouseUp:(NSEvent *)theEvent
QPointer< QWidget > widget
The QFlag class is a helper data type for QFlags.
int byteCount() const
Returns the number of bytes occupied by the image data.
struct CGImage * CGImageRef
int bytesPerLine() const
Returns the number of bytes per image scanline.
Q_CORE_EXPORT void qDebug(const char *,...)
void handleMouseEvent:(NSEvent *theEvent)
static void handleMouseEvent(QWidget *w, const QPoint &local, const QPoint &global, Qt::MouseButtons b)
tlw == 0 means that ev is in global coords only
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
int depth() const
Returns the depth of the image.
Qt::MouseButtons m_buttons
uchar * bits()
Returns a pointer to the first pixel data.
int width() const
Returns the width of the image.
struct CGColorSpace * CGColorSpaceRef
The QPoint class defines a point in the plane using integer precision.
int height() const
Returns the height of the image.
struct CGContext * CGContextRef
static void handleEnterEvent(QWidget *w)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
static void handleLeaveEvent(QWidget *w)