From acde9118f87ebd5aba5904072e40997a2a155d13 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:09:06 +1000 Subject: Make screen rotation work properly with the PowerVR screen driver Task-number: QT-2261 Reviewed-by: Tom Back port of 75719e4e06882825fe056935d782b4153bf0ac5b --- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 10 ++++ .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h | 3 + .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h | 1 + .../gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c | 14 ++++- src/plugins/gfxdrivers/powervr/README | 5 ++ .../powervr/pvreglscreen/pvreglscreen.cpp | 67 +++++++++++++++++++++- .../gfxdrivers/powervr/pvreglscreen/pvreglscreen.h | 9 ++- .../powervr/pvreglscreen/pvreglwindowsurface.cpp | 54 ++++++++++++++++- .../powervr/pvreglscreen/pvreglwindowsurface.h | 8 ++- 9 files changed, 162 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index ac9dc8d834..c1b655a5b1 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -617,6 +617,16 @@ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect) *rect = drawable->rect; } +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle) +{ + if (drawable->rotationAngle != angle) { + drawable->rotationAngle = angle; + + /* Force the buffers to be recreated if the rotation angle changes */ + pvrQwsInvalidateBuffers(drawable); + } +} + int pvrQwsGetStride(PvrQwsDrawable *drawable) { if (drawable->backBuffersValid) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index 952ff6ff52..b9e035f084 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -126,6 +126,9 @@ void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect); /* Get the current geometry for a drawable */ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect); +/* Set the rotation angle in degrees */ +void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle); + /* Get the line stride for a drawable. Returns zero if the buffers are not allocated or have been invalidated */ int pvrQwsGetStride(PvrQwsDrawable *drawable); diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h index cf80a90b1c..dcd4e4fbc8 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h @@ -114,6 +114,7 @@ struct _PvrQwsDrawable int isFullScreen; int strideBytes; int stridePixels; + int rotationAngle; PvrQwsSwapFunction swapFunction; void *userData; PvrQwsDrawable *nextWinId; diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c index 253f39f11e..28b22518ab 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c @@ -132,6 +132,16 @@ static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display) return WSEGL_SUCCESS; } +static WSEGLRotationAngle wseglRotationValue(int degrees) +{ + switch (degrees) { + case 90: return WSEGL_ROTATE_90; + case 180: return WSEGL_ROTATE_180; + case 270: return WSEGL_ROTATE_270; + default: return WSEGL_ROTATE_0; + } +} + /* Create the WSEGL drawable version of a native window */ static WSEGLError wseglCreateWindowDrawable (WSEGLDisplayHandle display, WSEGLConfig *config, @@ -152,7 +162,7 @@ static WSEGLError wseglCreateWindowDrawable *drawable = (WSEGLDrawableHandle)screen; if (!pvrQwsAllocBuffers(screen)) return WSEGL_OUT_OF_MEMORY; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(screen->rotationAngle); return WSEGL_SUCCESS; } @@ -163,7 +173,7 @@ static WSEGLError wseglCreateWindowDrawable /* The drawable is ready to go */ *drawable = (WSEGLDrawableHandle)draw; - *rotationAngle = WSEGL_ROTATE_0; + *rotationAngle = wseglRotationValue(draw->rotationAngle); if (!pvrQwsAllocBuffers(draw)) return WSEGL_OUT_OF_MEMORY; return WSEGL_SUCCESS; diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index 4dce87f830..322a6b2e01 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -51,6 +51,11 @@ on the device with: hellogl_es -qws +The driver also supports screen rotation if Qt is configured with the +-qt-gfx-transformed option and the QWS_DISPLAY variable is wrapped in a +"Transformed" declaration: + + Transformed:powervr:mmWidth40:mmHeight54:Rot90:0 Know Issues: * A QGLWidget may not have window decorations if it is a top-level window. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index 66966720b3..2e4c6d10db 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -44,6 +44,9 @@ #include "pvrqwsdrawable_p.h" #include #include +#ifndef QT_NO_QWS_TRANSFORMED +#include +#endif #include #include #include @@ -60,6 +63,7 @@ PvrEglScreen::PvrEglScreen(int displayId) ttyfd = -1; doGraphicsMode = true; oldKdMode = KD_TEXT; + parent = 0; // Make sure that the EGL layer is initialized and the drivers loaded. EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); @@ -189,7 +193,7 @@ bool PvrEglScreen::hasOpenGL() QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const { if (qobject_cast(widget)) - return new PvrEglWindowSurface(widget, (QScreen *)this, displayId); + return new PvrEglWindowSurface(widget, (PvrEglScreen *)this, displayId); return QScreen::createSurface(widget); } @@ -202,6 +206,67 @@ QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const return QScreen::createSurface(key); } +#ifndef QT_NO_QWS_TRANSFORMED + +static const QScreen *parentScreen + (const QScreen *current, const QScreen *lookingFor) +{ + if (!current) + return 0; + switch (current->classId()) { + case QScreen::ProxyClass: + case QScreen::TransformedClass: { + const QScreen *child = + static_cast(current)->screen(); + if (child == lookingFor) + return current; + else + return parentScreen(child, lookingFor); + } + // Not reached. + + case QScreen::MultiClass: { + QList screens = current->subScreens(); + foreach (QScreen *screen, screens) { + if (screen == lookingFor) + return current; + const QScreen *parent = parentScreen(screen, lookingFor); + if (parent) + return parent; + } + } + break; + + default: break; + } + return 0; +} + +int PvrEglScreen::transformation() const +{ + // We need to search for our parent screen, which is assumed to be + // "Transformed". If it isn't, then there is no transformation. + // There is no direct method to get the parent screen so we need + // to search every screen until we find ourselves. + if (!parent && qt_screen != this) + parent = parentScreen(qt_screen, this); + if (!parent) + return 0; + if (parent->classId() != QScreen::TransformedClass) + return 0; + return 90 * static_cast(parent) + ->transformation(); +} + +#else + +int PvrEglScreen::transformation() const +{ + return 0; +} + +#endif + void PvrEglScreen::sync() { // Put code here to synchronize 2D and 3D operations if necessary. diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h index 8bf42c7fc6..5769e7025c 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h @@ -46,16 +46,18 @@ #include #include "pvrqwsdrawable.h" +class PvrEglScreen; + class PvrEglScreenSurfaceFunctions : public QGLScreenSurfaceFunctions { public: - PvrEglScreenSurfaceFunctions(QScreen *s, int screenNum) + PvrEglScreenSurfaceFunctions(PvrEglScreen *s, int screenNum) : screen(s), displayId(screenNum) {} bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native); private: - QScreen *screen; + PvrEglScreen *screen; int displayId; }; @@ -80,6 +82,8 @@ public: QWSWindowSurface* createSurface(QWidget *widget) const; QWSWindowSurface* createSurface(const QString &key) const; + int transformation() const; + private: void sync(); void openTty(); @@ -89,6 +93,7 @@ private: int ttyfd, oldKdMode; QString ttyDevice; bool doGraphicsMode; + mutable const QScreen *parent; }; #endif diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 2c5ac21711..4a3787f537 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -46,7 +46,7 @@ #include PvrEglWindowSurface::PvrEglWindowSurface - (QWidget *widget, QScreen *screen, int screenNum) + (QWidget *widget, PvrEglScreen *screen, int screenNum) : QWSGLWindowSurface(widget) { setSurfaceFlags(QWSWindowSurface::Opaque); @@ -63,6 +63,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrRect.y = pos.y(); pvrRect.width = size.width(); pvrRect.height = size.height(); + transformRects(&pvrRect, 1); // Try to recover a previous PvrQwsDrawable object for the widget // if there is one. This can happen when a PvrEglWindowSurface @@ -75,6 +76,7 @@ PvrEglWindowSurface::PvrEglWindowSurface pvrQwsSetGeometry(drawable, &pvrRect); else drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } PvrEglWindowSurface::PvrEglWindowSurface() @@ -113,7 +115,9 @@ void PvrEglWindowSurface::setGeometry(const QRect &rect) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } QWSGLWindowSurface::setGeometry(rect); } @@ -127,7 +131,9 @@ bool PvrEglWindowSurface::move(const QPoint &offset) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetGeometry(drawable, &pvrRect); + pvrQwsSetRotation(drawable, screen->transformation()); } return QWSGLWindowSurface::move(offset); } @@ -200,7 +206,9 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRect.y = rect.y(); pvrRect.width = rect.width(); pvrRect.height = rect.height(); + transformRects(&pvrRect, 1); pvrQwsSetVisibleRegion(drawable, &pvrRect, 1); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); } else { @@ -213,9 +221,53 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) pvrRects[index].width = rect.width(); pvrRects[index].height = rect.height(); } + transformRects(pvrRects, rects.size()); pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size()); + pvrQwsSetRotation(drawable, screen->transformation()); if (!pvrQwsSwapBuffers(drawable, 1)) screen->solidFill(QColor(0, 0, 0), region); delete [] pvrRects; } } + +void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const +{ + switch (screen->transformation()) { + case 0: break; + + case 90: + { + for (int index = 0; index < count; ++index) { + int x = rects[index].y; + int y = screen->height() - (rects[index].x + rects[index].width); + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + + case 180: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].x + rects[index].width); + int y = screen->height() - (rects[index].y + rects[index].height); + rects[index].x = x; + rects[index].y = y; + } + } + break; + + case 270: + { + for (int index = 0; index < count; ++index) { + int x = screen->width() - (rects[index].y + rects[index].height); + int y = rects[index].x; + rects[index].x = x; + rects[index].y = y; + qSwap(rects[index].width, rects[index].height); + } + } + break; + } +} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 58a5fb2361..b0a161c235 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -45,12 +45,12 @@ #include #include "pvrqwsdrawable.h" -class QScreen; +class PvrEglScreen; class PvrEglWindowSurface : public QWSGLWindowSurface { public: - PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum); + PvrEglWindowSurface(QWidget *widget, PvrEglScreen *screen, int screenNum); PvrEglWindowSurface(); ~PvrEglWindowSurface(); @@ -76,8 +76,10 @@ public: private: QWidget *widget; PvrQwsDrawable *drawable; - QScreen *screen; + PvrEglScreen *screen; QPaintDevice *pdevice; + + void transformRects(PvrQwsRect *rects, int count) const; }; #endif -- cgit v1.2.3 From 24c05a4db9ad398139de8d660347513b301aa911 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:09:34 +1000 Subject: Remove unnecessary PowerVR helper functions The cross-process memory sharing code never really worked in the way we needed it to - so remove it until something better comes along. Reviewed-by: trustme Back port of 04648b44f0784223122a782320d0b09b5c1e9497 --- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 60 ---------------------- .../gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h | 15 ------ 2 files changed, 75 deletions(-) (limited to 'src') diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index c1b655a5b1..17345a9983 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -828,63 +828,3 @@ void pvrQwsSetSwapFunction drawable->swapFunction = func; drawable->userData = userData; } - -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable) -{ - unsigned long addr; - unsigned long start; - unsigned long end; - unsigned long off; - unsigned long offset; - FILE *file; - char buffer[BUFSIZ]; - char flags[16]; - - if (!drawable->backBuffersValid) - return 0; - addr = (unsigned long) - (drawable->backBuffers[drawable->currentBackBuffer]->pBase); - - /* Search /proc/self/maps for the memory region that contains "addr". - The file offset for that memory region is the identifier we need */ - file = fopen("/proc/self/maps", "r"); - if (!file) { - perror("/proc/self/maps"); - return 0; - } - offset = 0; - while (fgets(buffer, sizeof(buffer), file)) { - if (sscanf(buffer, "%lx-%lx %s %lx", - &start, &end, flags, &off) < 4) - continue; - if (start <= addr && addr < end) { - offset = off; - break; - } - } - fclose(file); - return offset; -} - -void *pvrQwsMapMemory(unsigned long id, int size) -{ - void *addr; - int fd = open("/dev/pvrsrv", O_RDWR, 0); - if (fd < 0) { - perror("/dev/pvrsrv"); - return 0; - } - addr = mmap(0, (size_t)size, PROT_READ | PROT_WRITE, - MAP_SHARED, fd, (off_t)id); - if (addr == (void *)(-1)) { - perror("mmap pvr memory region"); - addr = 0; - } - close(fd); - return addr; -} - -void pvrQwsUnmapMemory(void *addr, int size) -{ - munmap(addr, size); -} diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h index b9e035f084..55e031002c 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h @@ -162,21 +162,6 @@ int pvrQwsSwapBuffers(PvrQwsDrawable *drawable, int repaintOnly); void pvrQwsSetSwapFunction (PvrQwsDrawable *drawable, PvrQwsSwapFunction func, void *userData); -/* Get a memory identifier for the indicated drawable's buffer. - The identifier can be passed to another process and then - passed to pvrQwsMapMemory() to map the drawable's buffer into - the other process's address space. Returns zero if the - memory identifier could not be determined. This should only - be used for pixmap drawables */ -unsigned long pvrQwsGetMemoryId(PvrQwsDrawable *drawable); - -/* Map the memory buffer of a foreign application's drawable, as - indicated by "id" and "size". Returns null if the map failed */ -void *pvrQwsMapMemory(unsigned long id, int size); - -/* Unmap the memory obtained from pvrQwsMapMemory() */ -void pvrQwsUnmapMemory(void *addr, int size); - #ifdef __cplusplus }; #endif -- cgit v1.2.3 From 49134383c2fd81b9253207b70aaf2530526b044d Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:09:51 +1000 Subject: The shipped pvr2d.h/wsegl.h for PowerVR do not work with MBX Reviewed-by: trustme Back port of 4ae09215de36fcfd17dc6875aca102d784d65012 --- src/plugins/gfxdrivers/powervr/README | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README index 322a6b2e01..513e7f5e9e 100644 --- a/src/plugins/gfxdrivers/powervr/README +++ b/src/plugins/gfxdrivers/powervr/README @@ -31,9 +31,10 @@ strictly Unix-style markers. * IMPORTANT: To build the QScreen plugin and the WSEGL library it depends * * on, the pvr2d.h, wsegl.h headers for your platform are required. You * * can find a copy of these headers in src/3rdparty/powervr for SGX based * -* platforms like the TI OMAP3xxx. They may also work on MBX platforms too * -* depending on how old your libEGL is. You can tell Qt where to find * -* these headers by setting QMAKE_INCDIR_POWERVR in the mkspec. * +* platforms like the TI OMAP3xxx. They probably will not work on MBX * +* because of differences in the layout of certain PVR2D structures. * +* You can tell Qt where to find the actual headers for your system by * +* setting QMAKE_INCDIR_POWERVR in the mkspec. * *************************************************************************** When you start a Qt/Embedded application, you should modify the QWS_DISPLAY -- cgit v1.2.3 From 0dc3e7f6b482d359b10bfe4e0a3032644b77c94b Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Mon, 2 Nov 2009 09:10:09 +1000 Subject: Increase PowerVR memory alignment from 8 to 32 for SGX systems. Increasing the alignment does not seem to affect MBX. Back port of 7997279bc22d30bf1d1a30a567bda33ecc9aeb2d --- src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index 17345a9983..a9c22ef7c1 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -662,7 +662,7 @@ int pvrQwsAllocBuffers(PvrQwsDrawable *drawable) PVR2DMemFree(pvrQwsDisplay.context, drawable->backBuffers[index]); } } - drawable->stridePixels = (drawable->rect.width + 7) & ~7; + drawable->stridePixels = (drawable->rect.width + 31) & ~31; drawable->strideBytes = drawable->stridePixels * pvrQwsDisplay.screens[drawable->screen].bytesPerPixel; -- cgit v1.2.3 From 5b21746da4899a7d6dd78cf949e0a918c127fd49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Luthi?= Date: Wed, 26 Aug 2009 13:13:36 +0200 Subject: Fix a freeze in QFileDialog (Mac) Running an open file dialog, for example with QFileDialog::getOpenFileName() can lead to a freeze if the user selects a folder, then selects a file in the parent folder and finally confirms the open dialog. Merge-request: 1327 Reviewed-by: Richard Moe Gustavsen --- src/gui/dialogs/qfiledialog_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/dialogs/qfiledialog_mac.mm b/src/gui/dialogs/qfiledialog_mac.mm index 3914ab1f7c..8bca0253b9 100644 --- a/src/gui/dialogs/qfiledialog_mac.mm +++ b/src/gui/dialogs/qfiledialog_mac.mm @@ -819,8 +819,8 @@ void QFileDialogPrivate::qt_mac_filedialog_event_proc(const NavEventCallbackMess || mode == QFileDialog::ExistingFiles){ // When changing directory, the current selection is cleared if // we are supposed to be selecting files only: - fileDialogPrivate->mCurrentSelectionList.clear(); if (!fileDialogPrivate->mCurrentSelection.isEmpty()){ + fileDialogPrivate->mCurrentSelectionList.clear(); fileDialogPrivate->mCurrentSelection.clear(); emit fileDialogPrivate->q_func()->currentChanged(fileDialogPrivate->mCurrentSelection); } -- cgit v1.2.3