46 #undef DEPRECATED_ATTRIBUTE 47 #define DEPRECATED_ATTRIBUTE 49 #ifndef QT_MAC_USE_COCOA 53 # include <AGL/aglRenderers.h> 54 # include <OpenGL/gl.h> 56 # define qDebug qt_noop(),1?(void)0:qDebug 60 # include <AGL/aglRenderers.h> 61 # include <OpenGL/gl.h> 64 #include <private/qcocoaview_mac_p.h> 68 #include <OpenGL/gl.h> 69 #include <CoreServices/CoreServices.h> 70 #include <private/qfont_p.h> 71 #include <private/qfontengine_p.h> 72 #include <private/qgl_p.h> 73 #include <private/qpaintengine_opengl_p.h> 74 #include <private/qt_mac_p.h> 83 #ifdef QT_MAC_USE_COCOA 92 void *qt_current_nsopengl_context()
94 return [NSOpenGLContext currentContext];
97 static GLint attribValue(NSOpenGLPixelFormat *fmt, NSOpenGLPixelFormatAttribute attrib)
100 [fmt
getValues:&res forAttribute:attrib forVirtualScreen:0];
104 static int def(
int val,
int defVal)
106 return val != -1 ? val : defVal;
125 #ifndef QT_MAC_USE_COCOA 128 NSOpenGLContext *
ctx;
136 #ifndef QT_MAC_USE_COCOA 137 GLint attribs[] = {AGL_RGBA, AGL_NONE};
138 AGLPixelFormat fmt = aglChoosePixelFormat(0, 0, attribs);
140 qDebug(
"QGLTemporaryContext: Couldn't find any RGB visuals");
143 d->
ctx = aglCreateContext(fmt, 0);
145 qDebug(
"QGLTemporaryContext: Unable to create context");
147 aglSetCurrentContext(
d->
ctx);
148 aglDestroyPixelFormat(fmt);
151 NSOpenGLPixelFormatAttribute attribs[] = { 0 };
152 NSOpenGLPixelFormat *fmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
154 qWarning(
"QGLTemporaryContext: Cannot find any visuals");
158 d->
ctx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:0];
160 qWarning(
"QGLTemporaryContext: Cannot create context");
162 [
d->
ctx makeCurrentContext];
170 #ifndef QT_MAC_USE_COCOA 171 aglSetCurrentContext(0);
172 aglDestroyContext(
d->
ctx);
174 [NSOpenGLContext clearCurrentContext];
195 d->vi = chooseMacVisual(0);
199 #ifndef QT_MAC_USE_COCOA 200 AGLPixelFormat fmt = (AGLPixelFormat)
d->vi;
202 aglDescribePixelFormat(fmt, AGL_LEVEL, &res);
203 d->glFormat.setPlane(res);
204 if (deviceIsPixmap())
207 aglDescribePixelFormat(fmt, AGL_DOUBLEBUFFER, &res);
208 d->glFormat.setDoubleBuffer(res);
209 aglDescribePixelFormat(fmt, AGL_DEPTH_SIZE, &res);
210 d->glFormat.setDepth(res);
211 if (
d->glFormat.depth())
212 d->glFormat.setDepthBufferSize(res);
213 aglDescribePixelFormat(fmt, AGL_RGBA, &res);
214 d->glFormat.setRgba(res);
215 aglDescribePixelFormat(fmt, AGL_RED_SIZE, &res);
216 d->glFormat.setRedBufferSize(res);
217 aglDescribePixelFormat(fmt, AGL_GREEN_SIZE, &res);
218 d->glFormat.setGreenBufferSize(res);
219 aglDescribePixelFormat(fmt, AGL_BLUE_SIZE, &res);
220 d->glFormat.setBlueBufferSize(res);
221 aglDescribePixelFormat(fmt, AGL_ALPHA_SIZE, &res);
222 d->glFormat.setAlpha(res);
223 if (
d->glFormat.alpha())
224 d->glFormat.setAlphaBufferSize(res);
225 aglDescribePixelFormat(fmt, AGL_ACCUM_RED_SIZE, &res);
229 d->glFormat.setAccum(res > 5);
230 if (
d->glFormat.accum())
231 d->glFormat.setAccumBufferSize(res);
232 aglDescribePixelFormat(fmt, AGL_STENCIL_SIZE, &res);
233 d->glFormat.setStencil(res);
234 if (
d->glFormat.stencil())
235 d->glFormat.setStencilBufferSize(res);
236 aglDescribePixelFormat(fmt, AGL_STEREO, &res);
237 d->glFormat.setStereo(res);
238 aglDescribePixelFormat(fmt, AGL_SAMPLE_BUFFERS_ARB, &res);
239 d->glFormat.setSampleBuffers(res);
240 if (
d->glFormat.sampleBuffers()) {
241 aglDescribePixelFormat(fmt, AGL_SAMPLES_ARB, &res);
242 d->glFormat.setSamples(res);
245 NSOpenGLPixelFormat *fmt =
static_cast<NSOpenGLPixelFormat *
>(
d->vi);
250 d->glFormat.setDoubleBuffer(attribValue(fmt, NSOpenGLPFADoubleBuffer));
252 int depthSize = attribValue(fmt, NSOpenGLPFADepthSize);
253 d->glFormat.setDepth(depthSize > 0);
255 d->glFormat.setDepthBufferSize(depthSize);
257 int alphaSize = attribValue(fmt, NSOpenGLPFAAlphaSize);
258 d->glFormat.setAlpha(alphaSize > 0);
260 d->glFormat.setAlphaBufferSize(alphaSize);
262 int accumSize = attribValue(fmt, NSOpenGLPFAAccumSize);
263 d->glFormat.setAccum(accumSize > 0);
265 d->glFormat.setAccumBufferSize(accumSize);
267 int stencilSize = attribValue(fmt, NSOpenGLPFAStencilSize);
268 d->glFormat.setStencil(stencilSize > 0);
270 d->glFormat.setStencilBufferSize(stencilSize);
272 d->glFormat.setStereo(attribValue(fmt, NSOpenGLPFAStereo));
274 int sampleBuffers = attribValue(fmt, NSOpenGLPFASampleBuffers);
275 d->glFormat.setSampleBuffers(sampleBuffers);
276 if (sampleBuffers > 0)
277 d->glFormat.setSamples(attribValue(fmt, NSOpenGLPFASamples));
279 if (shareContext && (!shareContext->
isValid() || !shareContext->d_func()->cx)) {
280 qWarning(
"QGLContext::chooseContext: Cannot share with invalid context");
288 #ifndef QT_MAC_USE_COCOA 289 AGLContext
ctx = aglCreateContext(fmt, (AGLContext) (shareContext ? shareContext->d_func()->cx : 0));
291 NSOpenGLContext *ctx = [[NSOpenGLContext alloc] initWithFormat:fmt
292 shareContext:(shareContext ?
static_cast<NSOpenGLContext *
>(shareContext->d_func()->cx)
296 #ifndef QT_MAC_USE_COCOA 297 GLenum err = aglGetError();
298 if (err == AGL_BAD_MATCH || err == AGL_BAD_CONTEXT) {
299 if (shareContext && shareContext->d_func()->cx) {
300 qWarning(
"QGLContext::chooseContext(): Context sharing mismatch!");
301 if (!(ctx = aglCreateContext(fmt, 0)))
308 ctx = [[NSOpenGLContext alloc] initWithFormat:fmt shareContext:0];
310 qWarning(
"QGLContext::chooseContext: Context sharing mismatch");
316 qWarning(
"QGLContext::chooseContext: Unable to create QGLContext");
321 if (shareContext && shareContext->d_func()->cx) {
324 share->d_func()->sharing =
true;
326 if (deviceIsPixmap())
330 GLint interval =
d->reqFormat.swapInterval();
331 if (interval != -1) {
332 #ifndef QT_MAC_USE_COCOA 333 aglSetInteger((AGLContext)
d->cx, AGL_SWAP_INTERVAL, &interval);
335 aglEnable((AGLContext)
d->cx, AGL_SWAP_INTERVAL);
337 aglDisable((AGLContext)
d->cx, AGL_SWAP_INTERVAL);
339 [ctx setValues:&interval forParameter:NSOpenGLCPSwapInterval];
342 #ifndef QT_MAC_USE_COCOA 343 aglGetInteger((AGLContext)
d->cx, AGL_SWAP_INTERVAL, &interval);
345 [ctx
getValues:&interval forParameter:NSOpenGLCPSwapInterval];
347 d->glFormat.setSwapInterval(interval);
353 static const int Max = 40;
354 #ifndef QT_MAC_USE_COCOA 355 GLint attribs[Max], cnt = 0;
358 attribs[cnt++] = AGL_RGBA;
359 attribs[cnt++] = AGL_BUFFER_SIZE;
360 attribs[cnt++] = device_is_pixmap ?
static_cast<QPixmap *
>(paintDevice)->depth() : 32;
361 attribs[cnt++] = AGL_LEVEL;
362 attribs[cnt++] = format.
plane();
365 attribs[cnt++] = AGL_RED_SIZE;
369 attribs[cnt++] = AGL_GREEN_SIZE;
373 attribs[cnt++] = AGL_BLUE_SIZE;
376 if (device_is_pixmap) {
377 attribs[cnt++] = AGL_PIXEL_SIZE;
378 attribs[cnt++] =
static_cast<QPixmap *
>(paintDevice)->depth();
379 attribs[cnt++] = AGL_OFFSCREEN;
380 if (!format.
alpha()) {
381 attribs[cnt++] = AGL_ALPHA_SIZE;
386 attribs[cnt++] = AGL_DOUBLEBUFFER;
390 attribs[cnt++] = AGL_STEREO;
391 if (format.
alpha()) {
392 attribs[cnt++] = AGL_ALPHA_SIZE;
396 attribs[cnt++] = AGL_STENCIL_SIZE;
399 if (format.
depth()) {
400 attribs[cnt++] = AGL_DEPTH_SIZE;
403 if (format.
accum()) {
404 attribs[cnt++] = AGL_ACCUM_RED_SIZE;
406 attribs[cnt++] = AGL_ACCUM_BLUE_SIZE;
408 attribs[cnt++] = AGL_ACCUM_GREEN_SIZE;
410 attribs[cnt++] = AGL_ACCUM_ALPHA_SIZE;
414 attribs[cnt++] = AGL_SAMPLE_BUFFERS_ARB;
416 attribs[cnt++] = AGL_SAMPLES_ARB;
420 attribs[cnt] = AGL_NONE;
422 return aglChoosePixelFormat(0, 0, attribs);
424 NSOpenGLPixelFormatAttribute attribs[Max];
426 int devType = paintDevice->devType();
428 int depth = device_is_pixmap ?
static_cast<QPixmap *
>(paintDevice)->depth() : 32;
430 attribs[cnt++] = NSOpenGLPFAColorSize;
431 attribs[cnt++] = depth;
433 if (device_is_pixmap) {
434 attribs[cnt++] = NSOpenGLPFAOffScreen;
437 attribs[cnt++] = NSOpenGLPFADoubleBuffer;
439 if (glFormat.stereo())
440 attribs[cnt++] = NSOpenGLPFAStereo;
441 if (device_is_pixmap || format.
alpha()) {
442 attribs[cnt++] = NSOpenGLPFAAlphaSize;
446 attribs[cnt++] = NSOpenGLPFAStencilSize;
449 if (format.
depth()) {
450 attribs[cnt++] = NSOpenGLPFADepthSize;
453 if (format.
accum()) {
454 attribs[cnt++] = NSOpenGLPFAAccumSize;
458 attribs[cnt++] = NSOpenGLPFASampleBuffers;
460 attribs[cnt++] = NSOpenGLPFASamples;
461 attribs[cnt++] = def(format.
samples(), 4);
465 attribs[cnt++] = NSOpenGLPFAPixelBuffer;
469 return [[NSOpenGLPixelFormat alloc] initWithAttributes:attribs];
475 [
static_cast<NSOpenGLContext *
>(cx) clearDrawable];
496 void *fmt =
d->tryFormat(
d->glFormat);
497 if (!fmt &&
d->glFormat.stereo()) {
498 d->glFormat.setStereo(
false);
499 fmt =
d->tryFormat(
d->glFormat);
501 if (!fmt &&
d->glFormat.sampleBuffers()) {
502 d->glFormat.setSampleBuffers(
false);
503 fmt =
d->tryFormat(
d->glFormat);
506 qWarning(
"QGLContext::chooseMacVisual: Unable to choose a pixel format");
517 #ifndef QT_MAC_USE_COCOA 519 aglDestroyContext((AGLContext)
d->cx);
522 [
static_cast<NSOpenGLContext *
>(
d->cx) release];
525 #ifndef QT_MAC_USE_COCOA 527 aglDestroyPixelFormat((AGLPixelFormat)
d->vi);
529 [
static_cast<NSOpenGLPixelFormat *
>(
d->vi) release];
545 qWarning(
"QGLContext::makeCurrent: Cannot make invalid context current");
548 #ifndef QT_MAC_USE_COCOA 549 aglSetCurrentContext((AGLContext)
d->cx);
553 [
static_cast<NSOpenGLContext *
>(
d->cx) makeCurrentContext];
558 #ifndef QT_MAC_USE_COCOA 567 if (!widget | !widget->
window())
574 if (systemScale ==
float(1))
586 #ifndef QT_MAC_USE_COCOA 593 #ifdef DEBUG_OPENGL_REGION_UPDATE 594 static int serial_no_gl = 0;
595 qDebug(
"[%d] %p setting on %s::%s %p/%p [%s]", ++serial_no_gl, w,
597 hiview,
window, w->handle() ?
"Inside" :
"Outside");
602 aglSetDrawable((AGLContext)
d->cx, 0);
606 AGLDrawable old_draw = aglGetDrawable((AGLContext)
d->cx), new_draw = GetWindowPort(window);
607 if (old_draw != new_draw)
608 aglSetDrawable((AGLContext)
d->cx, new_draw);
616 #ifdef DEBUG_OPENGL_REGION_UPDATE 621 for(
int i = 0; i < rs.
count(); i++)
622 qDebug(
" %d %d %d %d", rs[i].x(), rs[i].y(), rs[i].width(), rs[i].height());
626 if (!aglIsEnabled((AGLContext)
d->cx, AGL_BUFFER_RECT))
627 aglEnable((AGLContext)
d->cx, AGL_BUFFER_RECT);
629 GLint offs[4] = { 0, 0, 0, 0 };
630 aglSetInteger((AGLContext)
d->cx, AGL_BUFFER_RECT, offs);
631 if (aglIsEnabled((AGLContext)
d->cx, AGL_CLIP_REGION))
632 aglDisable((AGLContext)
d->cx, AGL_CLIP_REGION);
634 HIPoint origin = { 0., 0. };
643 if (scale !=
float(1)) {
646 GetRegionBounds(region, ®ionBounds);
647 Rect regionBoundsDest = regionBounds;
648 regionBoundsDest.bottom *= scale;
649 regionBoundsDest.right *= scale;
650 MapRgn(region, ®ionBounds, ®ionBoundsDest);
653 aglSetInteger((AGLContext)
d->cx, AGL_BUFFER_RECT, offs);
654 aglSetInteger((AGLContext)
d->cx, AGL_CLIP_REGION, (
const GLint *)region);
655 if (!aglIsEnabled((AGLContext)
d->cx, AGL_CLIP_REGION))
656 aglEnable((AGLContext)
d->cx, AGL_CLIP_REGION);
660 if (scale !=
float(1)) {
661 aglEnable((AGLContext)
d->cx, AGL_BUFFER_RECT);
663 aglSetInteger((AGLContext)
d->cx, AGL_BUFFER_RECT, offs);
669 unsigned long qdformat = k32ARGBPixelFormat;
670 if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
671 qdformat = k32BGRAPixelFormat;
676 NewGWorldFromPtr(&gworld, qdformat, &rect, 0, 0, 0,
680 PixMapHandle pixmapHandle = GetGWorldPixMap(gworld);
681 aglSetOffScreen(reinterpret_cast<AGLContext>(
d->cx), pm->
width(), pm->
height(),
682 GetPixRowBytes(pixmapHandle), GetPixBaseAddr(pixmapHandle));
684 qWarning(
"QGLContext::updatePaintDevice(): Not sure how to render OpenGL on this device!");
686 aglUpdateContext((AGLContext)
d->cx);
707 if ([static_cast<NSOpenGLContext *>(
d->cx) view] != view && ![view isHidden])
708 [static_cast<NSOpenGLContext *>(
d->cx) setView:view];
716 qWarning(
"QGLContext::updatePaintDevice: Not sure how to render OpenGL on this device");
718 [
static_cast<NSOpenGLContext *
>(
d->cx) update];
726 #ifndef QT_MAC_USE_COCOA
727 aglGetCurrentContext() != (AGLContext) d_func()->cx
729 [NSOpenGLContext currentContext] != d_func()->cx
735 #ifndef QT_MAC_USE_COCOA 736 aglSetCurrentContext(0);
738 [NSOpenGLContext clearCurrentContext];
747 #ifndef QT_MAC_USE_COCOA 748 aglSwapBuffers((AGLContext)
d->cx);
750 [
static_cast<NSOpenGLContext *
>(
d->cx) flushBuffer];
759 #ifndef QT_MAC_USE_COCOA 765 #ifndef QT_MAC_USE_COCOA 769 for(
int i = 0; i < 256; i++)
772 for(
int i = 0; i < 256; i++) {
773 if(cmap[i].isValid() && cmap[i] == c) {
780 for(ret = 0; ret < 256; ret++)
781 if(!cmap[ret].isValid())
785 qWarning(
"QGLContext::colorIndex(): Internal error!");
794 aglSetInteger((AGLContext)d_func()->cx, AGL_COLORMAP_ENTRY, vals);
797 return (
uint)(ret == -1 ? 0 : ret);
810 CFBundleRef bundle = 0;
813 urlString, kCFURLPOSIXPathStyle,
false);
815 bundle = CFBundleCreate(kCFAllocatorDefault, url);
816 CFRelease(urlString);
828 #ifndef QT_MAC_USE_COCOA 845 GetControlRegion((
HIViewRef)widget->
winId(), kControlStructureMetaPart, macr);
846 OffsetRgn(macr, wrect.
x(), wrect.
y());
850 for(
const QWidget *last_clip = 0, *clip = widget; clip; last_clip = clip, clip = clip->
parentWidget()) {
852 GetControlRegion((
HIViewRef)clip->winId(), kControlStructureMetaPart, macr);
853 OffsetRgn(macr, clip_pos.
x(), clip_pos.
y());
857 for(
int i = children.
size()-1; i >= 0; --i) {
858 if(
QWidget *child = qobject_cast<QWidget*>(children.
at(i))) {
859 if(child == last_clip)
871 if(child->isVisible() && !child->isMinimized() && !child->isTopLevel()) {
872 const QRect childRect =
QRect(clip_pos+child->pos(), child->size());
874 GetControlRegion((
HIViewRef)child->winId(), kControlStructureMetaPart, macr);
875 OffsetRgn(macr, childRect.
x(), childRect.
y());
883 clip_pos -= clip->pos();
901 #ifndef QT_MAC_USE_COCOA 903 d->glcx->d_func()->update =
true;
908 #ifdef QT_MAC_USE_COCOA 909 d->glcx->updatePaintDevice();
911 #ifndef QT_MAC_USE_COCOA 913 resizeGL(width() * scale, height() * scale);
915 resizeGL(width(), height());
936 qWarning(
"QGLWidget::setContext: Cannot set null context");
941 d->glcx->doneCurrent();
944 if (!
d->glcx->isValid())
945 d->glcx->create(shareContext ? shareContext : oldcx);
946 if (deleteOldContext && oldcx)
954 initContext(context, shareWidget);
976 return d_func()->cmap;
983 void QGLWidgetPrivate::updatePaintDevice()
986 glcx->updatePaintDevice();
The QColor class provides colors based on RGB, HSV or CMYK values.
virtual void swapBuffers() const
Swaps the screen contents with an off-screen buffer.
const struct __CFString * CFStringRef
#define QT_END_NAMESPACE
This macro expands to.
int width() const
Returns the width of the pixmap.
float qt_mac_get_scale_factor(QWidget *widget)
QPointer< QWidget > widget
QScopedPointer< QGLTemporaryContextPrivate > d
static void setCurrentContext(QGLContext *context)
int count(const T &t) const
Returns the number of occurrences of value in the vector.
struct OpaqueWindowPtr * WindowRef
static CFStringRef toCFStringRef(const QString &str)
QColor overlayTransparentColor() const
If this context is a valid context in an overlay plane, returns the plane's transparent color...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
void * getProcAddress(const QString &proc) const
Returns a function pointer to the GL extension function passed in proc.
ushort red
Returns the red color component of this color.
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
static void removeShare(const QGLContext *context)
RgnHandle qt_mac_get_rgn()
QRegion qt_mac_get_widget_rgn(const QWidget *widget)
Q_CORE_EXPORT void qDebug(const char *,...)
#define QT_FORWARD_DECLARE_CLASS(name)
#define QT_BEGIN_NAMESPACE
This macro expands to.
void generateFontDisplayLists(const QFont &fnt, int listBase)
Generates a set of 256 display lists for the 256 first characters in the font font.
QGLFormat format() const
Returns the frame buffer format that was obtained (this may be a subset of what was requested)...
The QGLContext class encapsulates an OpenGL rendering context.
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
const T & at(int i) const
Returns the item at index position i in the list.
struct OpaqueControlRef * HIViewRef
QRegion qt_mac_convert_mac_region(RgnHandle)
The QResizeEvent class contains event parameters for resize events.
Q_CORE_EXPORT void qWarning(const char *,...)
The QRegion class specifies a clip region for a painter.
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
struct OpaqueRgnHandle * RgnHandle
The QGLColormap class is used for installing custom colormaps into a QGLWidget.
static CFBundleRef qt_getOpenGLBundle()
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
void qt_mac_dispose_rgn(RgnHandle)
const char * constData() const
Returns a pointer to the data stored in the byte array.
void reset()
Resets the context and makes it invalid.
void * tryFormat(const QGLFormat &format)
virtual bool chooseContext(const QGLContext *shareContext=0)
This semi-internal function is called by create().
ushort blue
Returns the blue color component of this color.
int qt_mac_pixmap_get_bytes_per_line(const QPixmap *)
bool isValid() const
Returns true if a GL rendering context has been successfully created; otherwise returns false...
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
virtual void doneCurrent()
Makes no GL context the current context.
The QPoint class defines a point in the plane using integer precision.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
int size() const
Returns the number of items in the list.
QString objectName() const
The QRect class defines a rectangle in the plane using integer precision.
virtual void makeCurrent()
Makes this context the current OpenGL rendering context.
OSViewRef qt_mac_nativeview_for(const QWidget *)
QGLTemporaryContext(bool directRendering=true, QWidget *parent=0)
int y() const
Returns the y coordinate of this point.
quint32 * qt_mac_pixmap_get_base(const QPixmap *)
The QPixmap class is an off-screen image representation that can be used as a paint device...
uint colorIndex(const QColor &c) const
Returns a colormap index for the color c, in ColorIndex mode.
int height() const
Returns the height of the pixmap.
static const MacVersion MacintoshVersion
the version of the Macintosh operating system on which the application is run (Mac only)...
bool intersects(const QRect &r) const
Returns true if this rectangle intersects with the given rectangle (i.
int x() const
Returns the x coordinate of this point.
static QHash< QString, QVariant > getValues(const QString &prefix)
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
ushort green
Returns the green color component of this color.
virtual void * chooseMacVisual(GDHandle)
Mac OS X only: This virtual function tries to find a visual that matches the format, reducing the demands if the original request cannot be met.
Q_DECL_CONSTEXPR int qRound(qreal d)
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.
Handle handle() const
Returns a platform-specific region handle.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.