diff options
author | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-15 04:01:41 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2009-10-15 04:01:41 (GMT) |
commit | 2c46a28541c3d75639c00e7ee7e82113beec9a4a (patch) | |
tree | f708eff7418f8781fcc27a2fed3d827c207537b6 | |
parent | 266f13e567ada25441cd19461eaf02f37bc36d51 (diff) | |
parent | 4f2fecbdb852028bd191fa63aa66527107672dc7 (diff) | |
download | Qt-2c46a28541c3d75639c00e7ee7e82113beec9a4a.zip Qt-2c46a28541c3d75639c00e7ee7e82113beec9a4a.tar.gz Qt-2c46a28541c3d75639c00e7ee7e82113beec9a4a.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt into 4.5
-rw-r--r-- | src/gui/itemviews/qabstractitemview.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 22 | ||||
-rw-r--r-- | src/network/access/qhttpnetworkconnection.cpp | 5 | ||||
-rw-r--r-- | src/opengl/qgl_egl.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qgl_qws.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qglpixelbuffer_egl.cpp | 15 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp | 128 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h | 19 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp | 8 | ||||
-rw-r--r-- | src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h | 4 | ||||
-rw-r--r-- | tests/auto/qtreewidget/tst_qtreewidget.cpp | 39 |
11 files changed, 80 insertions, 166 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 6722e3a..a8c7f8b 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -2913,7 +2913,7 @@ void QAbstractItemView::update(const QModelIndex &index) //this test is important for peformance reason //For example in dataChanged we simply update all the cells without checking //it can be a major bottleneck to update rects that aren't even part of the viewport - if (d->viewport->geometry().intersects(rect)) + if (d->viewport->rect().intersects(rect)) d->viewport->update(rect); } } diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 9eca29d..286eb31 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1277,29 +1277,29 @@ Qt::DropAction QDragManager::drag(QDrag *o) // convert the image to NSImage. NSImage *image = (NSImage *)qt_mac_create_nsimage(pix); [image retain]; - DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; + DnDParams dndParams = *[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent]; // save supported actions - [dndParams->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; - NSPoint imageLoc = {dndParams->localPoint.x - hotspot.x(), - dndParams->localPoint.y + pix.height() - hotspot.y()}; + [dndParams.view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)]; + NSPoint imageLoc = {dndParams.localPoint.x - hotspot.x(), + dndParams.localPoint.y + pix.height() - hotspot.y()}; NSSize mouseOffset = {0.0, 0.0}; NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard]; - NSPoint windowPoint = [dndParams->theEvent locationInWindow]; + NSPoint windowPoint = [dndParams.theEvent locationInWindow]; dragPrivate()->executed_action = Qt::ActionMask; // do the drag - [dndParams->view retain]; - [dndParams->view dragImage:image + [dndParams.view retain]; + [dndParams.view dragImage:image at:imageLoc offset:mouseOffset - event:dndParams->theEvent + event:dndParams.theEvent pasteboard:pboard - source:dndParams->view + source:dndParams.view slideBack:YES]; - [dndParams->view release]; + [dndParams.view release]; [image release]; dragPrivate()->executed_action = Qt::IgnoreAction; object = 0; - Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction)); + Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams.performedAction)); // do post drag processing, if required. if(performedAction != Qt::IgnoreAction) { // check if the receiver points us to a file location. diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index aef1258..d747345 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -954,7 +954,10 @@ void QHttpNetworkConnectionPrivate::removeReply(QHttpNetworkReply *reply) for (int i = 0; i < channelCount; ++i) { if (channels[i].reply == reply) { channels[i].reply = 0; - if (reply->d_func()->connectionCloseEnabled()) + // if HTTP mandates we should close + // or the reply is not finished yet, e.g. it was aborted + // we have to close that connection + if (reply->d_func()->connectionCloseEnabled() || !reply->isFinished()) closeChannel(i); QMetaObject::invokeMethod(q, "_q_startNextRequest", Qt::QueuedConnection); return; diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 7e91c35..348a677 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -74,7 +74,7 @@ void qt_egl_set_format(QEglProperties& props, int deviceType, const QGLFormat& f props.setValue(EGL_STENCIL_SIZE, f.stencilBufferSize() == -1 ? 1 : f.stencilBufferSize()); if (f.sampleBuffers()) { props.setValue(EGL_SAMPLE_BUFFERS, 1); - props.setValue(EGL_SAMPLES, f.samples()); + props.setValue(EGL_SAMPLES, f.samples() == -1 ? 1 : f.samples()); } else { props.setValue(EGL_SAMPLE_BUFFERS, 0); } diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp index b842426..4058b66 100644 --- a/src/opengl/qgl_qws.cpp +++ b/src/opengl/qgl_qws.cpp @@ -187,6 +187,8 @@ void QGLContext::reset() d->cleanup(); doneCurrent(); if (d->eglContext) { + if (d->eglContext->surface() != EGL_NO_SURFACE) + eglDestroySurface(d->eglContext->display(), d->eglContext->surface()); delete d->eglContext; d->eglContext = 0; } diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index b2f16c1..fbe6c36 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -152,7 +152,7 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge bool QGLPixelBufferPrivate::cleanup() { - eglDestroySurface(QEglContext::defaultDisplay(0), pbuf); + // No need to destroy "pbuf" here - it is done in QGLContext::reset(). return true; } @@ -203,13 +203,20 @@ GLuint QGLPixelBuffer::generateDynamicTexture() const bool QGLPixelBuffer::hasOpenGLPbuffers() { // See if we have at least 1 configuration that matches the default format. - QEglContext ctx; - if (!ctx.openDisplay(0)) + EGLDisplay dpy = QEglContext::defaultDisplay(0); + if (dpy == EGL_NO_DISPLAY) return false; QEglProperties configProps; qt_egl_set_format(configProps, QInternal::Pbuffer, QGLFormat::defaultFormat()); configProps.setRenderableType(QEglContext::OpenGL); - return ctx.chooseConfig(configProps, QEglContext::BestPixelFormat); + do { + EGLConfig cfg = 0; + EGLint matching = 0; + if (eglChooseConfig(dpy, configProps.properties(), + &cfg, 1, &matching) && matching > 0) + return true; + } while (configProps.reduceConfiguration()); + return false; } QT_END_NAMESPACE diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp index cb453d7..6696672 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp @@ -60,17 +60,20 @@ PvrEglScreen::PvrEglScreen(int displayId) ttyfd = -1; doGraphicsMode = true; oldKdMode = KD_TEXT; - if (QWSServer::instance()) - holder = new PvrEglSurfaceHolder(); - else - holder = 0; + + // Make sure that the EGL layer is initialized and the drivers loaded. + EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); + if (!eglInitialize(dpy, 0, 0)) + qWarning("Could not initialize EGL display - are the drivers loaded?"); + + // Make sure that screen 0 is initialized. + pvrQwsScreenWindow(0); } PvrEglScreen::~PvrEglScreen() { if (fd >= 0) ::close(fd); - delete holder; } bool PvrEglScreen::initDevice() @@ -194,7 +197,7 @@ QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const { if (key == QLatin1String("PvrEgl")) - return new PvrEglWindowSurface(holder); + return new PvrEglWindowSurface(); return QScreen::createSurface(key); } @@ -275,116 +278,3 @@ bool PvrEglScreenSurfaceFunctions::createNativeWindow(QWidget *widget, EGLNative *native = (EGLNativeWindowType)(nsurface->nativeDrawable()); return true; } - -// The PowerVR engine on the device needs to allocate about 2Mb of -// contiguous physical memory to manage drawing into a surface. -// -// The problem is that once Qtopia begins its startup sequence, -// it allocates enough memory to severely fragment the physical -// address space on the device. This leaves the PowerVR engine -// unable to allocate the necessary contiguous physical memory -// when an EGL surface is created. -// -// A solution to this is to pre-allocate a dummy surface early -// in the startup sequence before memory becomes fragmented, -// reserving it for any future EGL applications to use. -// -// However, the PowerVR engine has problems managing multiple -// surfaces concurrently, and so real EGL applications end up -// with unacceptably slow frame rates unless the dummy surface -// is destroyed while the real EGL applications are running. -// -// In summary, we need to try to ensure that there is always at -// least one EGL surface active at any given time to reserve the -// memory but destroy the temporary surface when a real surface -// is using the device. That is the purpose of PvrEglSurfaceHolder. - -PvrEglSurfaceHolder::PvrEglSurfaceHolder(QObject *parent) - : QObject(parent) -{ - numRealSurfaces = 0; - - PvrQwsRect rect; - rect.x = 0; - rect.y = 0; - rect.width = 16; - rect.height = 16; - tempSurface = pvrQwsCreateWindow(0, -1, &rect); - - dpy = EGL_NO_DISPLAY; - config = 0; - surface = EGL_NO_SURFACE; - - dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY); - if (!eglInitialize(dpy, 0, 0)) { - qWarning("Could not initialize EGL display - are the drivers loaded?"); - dpy = EGL_NO_DISPLAY; - return; - } - - EGLint attribList[16]; - int temp = 0; - attribList[temp++] = EGL_LEVEL; // Framebuffer level 0 - attribList[temp++] = 0; - attribList[temp++] = EGL_SURFACE_TYPE; - attribList[temp++] = EGL_WINDOW_BIT; - attribList[temp++] = EGL_NONE; - - EGLint numConfigs = 0; - if (!eglChooseConfig(dpy, attribList, &config, 1, &numConfigs) || numConfigs != 1) { - qWarning("Could not find a matching a EGL configuration"); - eglTerminate(dpy); - dpy = EGL_NO_DISPLAY; - return; - } - - surface = eglCreateWindowSurface - (dpy, config, (EGLNativeWindowType)(-1), NULL); - if (surface == EGL_NO_SURFACE) - qWarning("Could not create the temporary EGL surface"); -} - -PvrEglSurfaceHolder::~PvrEglSurfaceHolder() -{ - if (surface != EGL_NO_SURFACE) - eglDestroySurface(dpy, surface); - if (dpy != EGL_NO_DISPLAY) - eglTerminate(dpy); - if (tempSurface) - pvrQwsDestroyDrawable(tempSurface); -} - -// Add a real EGL surface to the system. -void PvrEglSurfaceHolder::addSurface() -{ - ++numRealSurfaces; - if (numRealSurfaces == 1) { - // Destroy the temporary surface while some other application - // is making use of the EGL sub-system for 3D rendering. - if (surface != EGL_NO_SURFACE) { - eglDestroySurface(dpy, surface); - surface = EGL_NO_SURFACE; - } - } -} - -// Remove an actual EGL surface from the system. -void PvrEglSurfaceHolder::removeSurface() -{ - if (numRealSurfaces > 0) { - --numRealSurfaces; - if (numRealSurfaces == 0) { - // The last real EGL surface has been destroyed, so re-create - // the temporary surface. There is a race condition here in - // that Qtopia could allocate a lot of memory just after - // the real EGL surface is destroyed but before we could - // create the temporary surface again. - if (surface == EGL_NO_SURFACE && dpy != EGL_NO_DISPLAY) { - surface = eglCreateWindowSurface - (dpy, config, (EGLNativeWindowType)(-1), NULL); - if (surface == EGL_NO_SURFACE) - qWarning("Could not re-create the temporary EGL surface"); - } - } - } -} diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h index 1c79f8e..8bf42c7 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h @@ -59,24 +59,6 @@ private: int displayId; }; -class PvrEglSurfaceHolder : public QObject -{ - Q_OBJECT -public: - PvrEglSurfaceHolder(QObject *parent=0); - ~PvrEglSurfaceHolder(); - - void addSurface(); - void removeSurface(); - -private: - int numRealSurfaces; - PvrQwsDrawable *tempSurface; - EGLDisplay dpy; - EGLConfig config; - EGLSurface surface; -}; - class PvrEglScreen : public QGLScreen { public: @@ -105,7 +87,6 @@ private: int fd; int ttyfd, oldKdMode; - PvrEglSurfaceHolder *holder; QString ttyDevice; bool doGraphicsMode; }; diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index 09c0ace..2c5ac21 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -53,7 +53,6 @@ PvrEglWindowSurface::PvrEglWindowSurface this->widget = widget; this->screen = screen; - this->holder = 0; this->pdevice = 0; QPoint pos = offset(widget); @@ -78,7 +77,7 @@ PvrEglWindowSurface::PvrEglWindowSurface drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect); } -PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder) +PvrEglWindowSurface::PvrEglWindowSurface() : QWSGLWindowSurface() { setSurfaceFlags(QWSWindowSurface::Opaque); @@ -86,9 +85,6 @@ PvrEglWindowSurface::PvrEglWindowSurface(PvrEglSurfaceHolder *holder) widget = 0; screen = 0; pdevice = 0; - - this->holder = holder; - holder->addSurface(); } PvrEglWindowSurface::~PvrEglWindowSurface() @@ -100,8 +96,6 @@ PvrEglWindowSurface::~PvrEglWindowSurface() if (drawable && pvrQwsReleaseWindow(drawable)) pvrQwsDestroyDrawable(drawable); - if (holder) - holder->removeSurface(); delete pdevice; } diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 0da3653..58a5fb2 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -46,13 +46,12 @@ #include "pvrqwsdrawable.h" class QScreen; -class PvrEglSurfaceHolder; class PvrEglWindowSurface : public QWSGLWindowSurface { public: PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum); - PvrEglWindowSurface(PvrEglSurfaceHolder *holder); + PvrEglWindowSurface(); ~PvrEglWindowSurface(); QString key() const { return QLatin1String("PvrEgl"); } @@ -78,7 +77,6 @@ private: QWidget *widget; PvrQwsDrawable *drawable; QScreen *screen; - PvrEglSurfaceHolder *holder; QPaintDevice *pdevice; }; diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp index d4fd1e3..3fcbdd6 100644 --- a/tests/auto/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp @@ -49,6 +49,9 @@ #include <qheaderview.h> #include <qlineedit.h> #include <QScrollBar> +#include <QStyledItemDelegate> + +#include "../../shared/util.h" //TESTED_CLASS= @@ -160,6 +163,7 @@ private slots: void task217309(); void setCurrentItemExpandsParent(); void task239150_editorWidth(); + void setTextUpdate(); public slots: void itemSelectionChanged(); @@ -3023,6 +3027,41 @@ void tst_QTreeWidget::task239150_editorWidth() +void tst_QTreeWidget::setTextUpdate() +{ + QTreeWidget treeWidget; + treeWidget.setColumnCount(2); + + class MyItemDelegate : public QStyledItemDelegate + { + public: + MyItemDelegate() : numPaints(0) { } + void paint(QPainter *painter, + const QStyleOptionViewItem &option, const QModelIndex &index) const + { + numPaints++; + QStyledItemDelegate::paint(painter, option, index); + } + + mutable int numPaints; + } delegate; + + treeWidget.setItemDelegate(&delegate); + treeWidget.show(); + QStringList strList; + strList << "variable1" << "0"; + QTreeWidgetItem *item = new QTreeWidgetItem(strList); + treeWidget.insertTopLevelItem(0, item); + QTest::qWait(50); + QTRY_VERIFY(delegate.numPaints > 0); + delegate.numPaints = 0; + + item->setText(1, "42"); + QApplication::processEvents(); + QTRY_VERIFY(delegate.numPaints > 0); +} + + QTEST_MAIN(tst_QTreeWidget) #include "tst_qtreewidget.moc" |