From 869285037c28afef45b368d30917617dabe61559 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Mon, 22 Nov 2010 12:55:43 +0200 Subject: Fix a build break when namespace is defined Reviewed-by: Jani Hautakangas --- src/opengl/gl2paintengineex/qtriangulator.cpp | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index 4c3deb6..75d5ce2 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -339,7 +339,7 @@ static inline qint64 qPointDistanceFromLine(const QPodPoint &p, const QPodPoint static inline bool qPointIsLeftOfLine(const QPodPoint &p, const QPodPoint &v1, const QPodPoint &v2) { - return ::qPointDistanceFromLine(p, v1, v2) < 0; + return QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p, v1, v2) < 0; } // Return: @@ -1741,7 +1741,7 @@ bool QTriangulator::ComplexToSimple::calculateIntersection(int left, int righ Intersection intersection; intersection.leftEdge = left; intersection.rightEdge = right; - intersection.intersectionPoint = ::qIntersectionPoint(u1, u2, v1, v2); + intersection.intersectionPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(u1, u2, v1, v2); if (!intersection.intersectionPoint.isValid()) return false; @@ -1767,10 +1767,10 @@ bool QTriangulator::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int return true; if (upper.x > qMax(l.x, u.x)) return false; - qint64 d = ::qPointDistanceFromLine(upper, l, u); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(upper, l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -1814,7 +1814,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); if (d == 0) { result.first = result.second = current; break; @@ -1828,7 +1828,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { result.first = current; @@ -1842,7 +1842,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { result.second = current; @@ -1864,7 +1864,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); if (d == 0) break; if (d < 0) { @@ -1885,7 +1885,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d >= 0); if (d == 0) { current = current->left; @@ -1899,7 +1899,7 @@ QPair::Node *, QRBTree::Node *> QTriangulator::ComplexToSim while (current) { const QPodPoint &v1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &v2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(point, v1, v2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(point, v1, v2); Q_ASSERT(d <= 0); if (d == 0) { current = current->right; @@ -1962,7 +1962,7 @@ void QTriangulator::ComplexToSimple::reorderEdgeListRange(QRBTree::Node template void QTriangulator::ComplexToSimple::sortEdgeList(const QPodPoint eventPoint) { - QIntersectionPoint eventPoint2 = ::qIntersectionPoint(eventPoint); + QIntersectionPoint eventPoint2 = QT_PREPEND_NAMESPACE(qIntersectionPoint)(eventPoint); while (!m_topIntersection.isEmpty() && m_topIntersection.top().intersectionPoint < eventPoint2) { Intersection intersection = m_topIntersection.pop(); @@ -2056,7 +2056,7 @@ void QTriangulator::ComplexToSimple::calculateIntersections() QPair::Node *, QRBTree::Node *> range = bounds(event.point); QRBTree::Node *leftNode = range.first ? m_edgeList.previous(range.first) : 0; int vertex = (event.type == Event::Upper ? m_edges.at(event.edge).upper() : m_edges.at(event.edge).lower()); - QIntersectionPoint eventPoint = ::qIntersectionPoint(event.point); + QIntersectionPoint eventPoint = QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point); if (range.first != 0) { splitEdgeListRange(range.first, range.second, vertex, eventPoint); @@ -2213,7 +2213,7 @@ void QTriangulator::ComplexToSimple::removeUnwantedEdgesAndConnect() while (current != b.second) { Q_ASSERT(current); Q_ASSERT(m_edges.at(current->data).node == current); - Q_ASSERT(::qIntersectionPoint(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); + Q_ASSERT(QT_PREPEND_NAMESPACE(qIntersectionPoint)(event.point).isOnLine(m_parent->m_vertices.at(m_edges.at(current->data).from), m_parent->m_vertices.at(m_edges.at(current->data).to))); Q_ASSERT(m_parent->m_vertices.at(m_edges.at(current->data).from) == event.point || m_parent->m_vertices.at(m_edges.at(current->data).to) == event.point); insertEdgeIntoVectorIfWanted(orderedEdges, current->data); current = m_edgeList.next(current); @@ -2612,10 +2612,10 @@ bool QTriangulator::SimpleToMonotone::edgeIsLeftOfEdge(int leftEdgeIndex, int const Edge &rightEdge = m_edges.at(rightEdgeIndex); const QPodPoint &u = m_parent->m_vertices.at(rightEdge.upper()); const QPodPoint &l = m_parent->m_vertices.at(rightEdge.lower()); - qint64 d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.upper()), l, u); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.upper()), l, u); // d < 0: left, d > 0: right, d == 0: on top if (d == 0) - d = ::qPointDistanceFromLine(m_parent->m_vertices.at(leftEdge.lower()), l, u); + d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(leftEdge.lower()), l, u); return d < 0; } @@ -2645,7 +2645,7 @@ QRBTree::Node *QTriangulator::SimpleToMonotone::searchEdgeLeftOfPoint(in while (current) { const QPodPoint &p1 = m_parent->m_vertices.at(m_edges.at(current->data).lower()); const QPodPoint &p2 = m_parent->m_vertices.at(m_edges.at(current->data).upper()); - qint64 d = ::qPointDistanceFromLine(m_parent->m_vertices.at(pointIndex), p1, p2); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(m_parent->m_vertices.at(pointIndex), p1, p2); if (d <= 0) { current = current->left; } else { @@ -2668,7 +2668,7 @@ void QTriangulator::SimpleToMonotone::classifyVertex(int i) const QPodPoint &p1 = m_parent->m_vertices.at(e1.from); const QPodPoint &p2 = m_parent->m_vertices.at(e2.from); const QPodPoint &p3 = m_parent->m_vertices.at(e2.to); - qint64 d = ::qPointDistanceFromLine(p1, p2, p3); + qint64 d = QT_PREPEND_NAMESPACE(qPointDistanceFromLine)(p1, p2, p3); Q_ASSERT(d != 0 || (!startOrSplit && !endOrMerge)); e2.type = RegularVertex; -- cgit v0.12 From 2ab77ea436c1ad1a35b0c8e2183aa78edbbe4765 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Thu, 25 Nov 2010 17:21:12 +0100 Subject: Fix some memory leaks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the retain/release mechanism for CGContexts. Some leaks were due to unnecessary retain calls. Task-number: QTBUG-15373 Reviewed-by: Samuel Rødal --- src/gui/kernel/qcocoaview_mac.mm | 2 ++ src/gui/painting/qpaintengine_mac.cpp | 3 ++- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 2 ++ src/gui/painting/qwindowsurface_mac.cpp | 2 ++ src/gui/painting/qwindowsurface_raster.cpp | 3 +++ 5 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index d5363bd..e02cf11 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -554,6 +554,7 @@ static int qCocoaViewCount = 0; } CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + CGContextRetain(cg); qwidgetprivate->hd = cg; // We steal the CGContext for flushing in the unified toolbar with the raster engine. @@ -653,6 +654,7 @@ static int qCocoaViewCount = 0; } qwidgetprivate->hd = 0; CGContextRestoreGState(cg); + CGContextRelease(cg); } - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp index e5323d8..601cf86 100644 --- a/src/gui/painting/qpaintengine_mac.cpp +++ b/src/gui/painting/qpaintengine_mac.cpp @@ -131,8 +131,9 @@ QMacCGContext::QMacCGContext(QPainter *p) CGContextTranslateCTM(context, native.dx(), native.dy()); } + } else { + CGContextRetain(context); } - CGContextRetain(context); } diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index b25757b..ace0a46 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -188,6 +188,8 @@ void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QP // Restore context. CGContextRestoreGState(context); + CGContextRelease(context); + widget->d_func()->cgContext = 0; widget->d_func()->hasOwnContext = false; } diff --git a/src/gui/painting/qwindowsurface_mac.cpp b/src/gui/painting/qwindowsurface_mac.cpp index 1c97ebb..9f24532 100644 --- a/src/gui/painting/qwindowsurface_mac.cpp +++ b/src/gui/painting/qwindowsurface_mac.cpp @@ -82,6 +82,7 @@ void QMacWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint extern CGContextRef qt_mac_graphicsContextFor(QWidget *); CGContextRef context = qt_mac_graphicsContextFor(widget); #endif + CGContextRetain(context); CGContextSaveGState(context); // Flip context. @@ -109,6 +110,7 @@ void QMacWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint #else CGContextFlush(context); #endif + CGContextRelease(context); } void QMacWindowSurface::setGeometry(const QRect &rect) diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index ae73d7d..2b4e125 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -285,6 +285,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi extern CGContextRef qt_mac_graphicsContextFor(QWidget *); CGContextRef context = qt_mac_graphicsContextFor(widget); #endif + CGContextRetain(context); CGContextSaveGState(context); // Flip context. @@ -317,6 +318,8 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi // Restore context. CGContextRestoreGState(context); + CGContextRelease(context); + #endif // Q_WS_MAC -- cgit v0.12 From 1753380c39e3b845f6acee21ce25bad75dbf910c Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:06 +0100 Subject: QKqueueFileSystemWatcherEngine: Use EV_CLEAR instead of EV_ONESHOT. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using EV_ONESHOT and re-enabling the kevent after emitting the signal allows for a window in which file system changes can go undetected. By using EV_CLEAR instead the kevent can stay enabled. Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 7960792..6e7a402 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -159,7 +159,7 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths, EV_SET(&kev, fd, EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, + EV_ADD | EV_ENABLE | EV_CLEAR, NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, 0, 0); @@ -317,24 +317,12 @@ void QKqueueFileSystemWatcherEngine::run() else emit fileChanged(path, true); } else { - DEBUG() << path << "changed, re-enabling watch"; + DEBUG() << path << "changed"; if (id < 0) emit directoryChanged(path, false); else emit fileChanged(path, false); - - // renable the watch - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_ONESHOT, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::processKqueueEvents: kevent EV_ADD"); - } } } -- cgit v0.12 From aeadc5efbe74c2c977d288205c17bf04b2ec172c Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:07 +0100 Subject: QKqueueFileSystemWatcherEngine: Deleting kevent is handled by close(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 6e7a402..6e7bc47 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -205,19 +205,7 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths if (x.isEmpty() || x != path) continue; - int fd = id < 0 ? -id : id; - struct kevent kev; - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_DELETE, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::removeWatch: kevent"); - } - ::close(fd); + ::close(id < 0 ? -id : id); it.remove(); if (id < 0) -- cgit v0.12 From 48467f2d8cba8da2589cb1e480e4ed40199626d9 Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:08 +0100 Subject: QKqueueFileSystemWatcherEngine: Handle kevent(2) returning EINTR. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The worker thread exits whenever the kevent call returns an error, but in the case of EINTR (interrupted by signal) it should just call kevent again. Otherwise for instance, attaching a debugger to the process causes the worker thread to exit because of the SIGSTOP it receives. Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 6e7bc47..c497570 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -236,9 +236,10 @@ void QKqueueFileSystemWatcherEngine::run() static const struct timespec ZeroTimeout = { 0, 0 }; forever { + int r; struct kevent kev; DEBUG() << "QKqueueFileSystemWatcherEngine: waiting for kevents..."; - int r = kevent(kqfd, 0, 0, &kev, 1, 0); + EINTR_LOOP(r, kevent(kqfd, 0, 0, &kev, 1, 0)); if (r < 0) { perror("QKqueueFileSystemWatcherEngine: error during kevent wait"); return; -- cgit v0.12 From d977d5f4d2da9e0aba211e53a3d040bcccc87f87 Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:09 +0100 Subject: QKqueueFileSystemWatcherEngine: Unlock mutex before calling write(2). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Calls to write(2) potentially block, so make sure the application thread unlocks the mutex before it writes to the pipe between itself and the worker thread, so the latter can continue to process events and eventually unblock the write call (if needed) by emptying the pipe. Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 134 ++++++++++++++------------- 1 file changed, 69 insertions(+), 65 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index c497570..644831b 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -119,67 +119,69 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths, QStringList *files, QStringList *directories) { - QMutexLocker locker(&mutex); - QStringList p = paths; - QMutableListIterator it(p); - while (it.hasNext()) { - QString path = it.next(); - int fd; + { + QMutexLocker locker(&mutex); + + QMutableListIterator it(p); + while (it.hasNext()) { + QString path = it.next(); + int fd; #if defined(O_EVTONLY) - fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY); + fd = qt_safe_open(QFile::encodeName(path), O_EVTONLY); #else - fd = qt_safe_open(QFile::encodeName(path), O_RDONLY); + fd = qt_safe_open(QFile::encodeName(path), O_RDONLY); #endif - if (fd == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: open"); - continue; - } + if (fd == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: open"); + continue; + } - QT_STATBUF st; - if (QT_FSTAT(fd, &st) == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: fstat"); - ::close(fd); - continue; - } - int id = (S_ISDIR(st.st_mode)) ? -fd : fd; - if (id < 0) { - if (directories->contains(path)) { + QT_STATBUF st; + if (QT_FSTAT(fd, &st) == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: fstat"); ::close(fd); continue; } - } else { - if (files->contains(path)) { + int id = (S_ISDIR(st.st_mode)) ? -fd : fd; + if (id < 0) { + if (directories->contains(path)) { + ::close(fd); + continue; + } + } else { + if (files->contains(path)) { + ::close(fd); + continue; + } + } + + struct kevent kev; + EV_SET(&kev, + fd, + EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_CLEAR, + NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, + 0, + 0); + if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { + perror("QKqueueFileSystemWatcherEngine::addPaths: kevent"); ::close(fd); continue; } - } - struct kevent kev; - EV_SET(&kev, - fd, - EVFILT_VNODE, - EV_ADD | EV_ENABLE | EV_CLEAR, - NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, - 0, - 0); - if (kevent(kqfd, &kev, 1, 0, 0, 0) == -1) { - perror("QKqueueFileSystemWatcherEngine::addPaths: kevent"); - ::close(fd); - continue; - } + it.remove(); + if (id < 0) { + DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path; + directories->append(path); + } else { + DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path; + files->append(path); + } - it.remove(); - if (id < 0) { - DEBUG() << "QKqueueFileSystemWatcherEngine: added directory path" << path; - directories->append(path); - } else { - DEBUG() << "QKqueueFileSystemWatcherEngine: added file path" << path; - files->append(path); + pathToID.insert(path, id); + idToPath.insert(id, path); } - - pathToID.insert(path, id); - idToPath.insert(id, path); } if (!isRunning()) @@ -194,31 +196,33 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths QStringList *files, QStringList *directories) { - QMutexLocker locker(&mutex); - + bool isEmpty; QStringList p = paths; - QMutableListIterator it(p); - while (it.hasNext()) { - QString path = it.next(); - int id = pathToID.take(path); - QString x = idToPath.take(id); - if (x.isEmpty() || x != path) - continue; + { + QMutexLocker locker(&mutex); - ::close(id < 0 ? -id : id); + QMutableListIterator it(p); + while (it.hasNext()) { + QString path = it.next(); + int id = pathToID.take(path); + QString x = idToPath.take(id); + if (x.isEmpty() || x != path) + continue; + + ::close(id < 0 ? -id : id); - it.remove(); - if (id < 0) - directories->removeAll(path); - else - files->removeAll(path); + it.remove(); + if (id < 0) + directories->removeAll(path); + else + files->removeAll(path); + } + isEmpty = pathToID.isEmpty(); } - if (pathToID.isEmpty()) { + if (isEmpty) { stop(); - locker.unlock(); wait(); - locker.relock(); } else { write(kqpipe[1], "@", 1); } -- cgit v0.12 From c6d4a2ca73ac57d47adee35d0d11c98c8b5130ee Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:10 +0100 Subject: QKqueueFileSystemWatcherEngine: Unlock mutex between two events. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the worker thread unlock the mutex between processing two events. Otherwise it's possible for the worker thread to block the application thread when many events occur. Also, there's no need to lock the mutex when processing a pipe event. Generally the worker thread should hamper the application thread as little as possible, so only lock the mutex where needed. Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 644831b..29cd111 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -237,8 +237,6 @@ void QKqueueFileSystemWatcherEngine::stop() void QKqueueFileSystemWatcherEngine::run() { - static const struct timespec ZeroTimeout = { 0, 0 }; - forever { int r; struct kevent kev; @@ -247,10 +245,7 @@ void QKqueueFileSystemWatcherEngine::run() if (r < 0) { perror("QKqueueFileSystemWatcherEngine: error during kevent wait"); return; - } - - QMutexLocker locker(&mutex); - do { + } else { int fd = kev.ident; DEBUG() << "QKqueueFileSystemWatcherEngine: processing kevent" << kev.ident << kev.filter; @@ -282,6 +277,8 @@ void QKqueueFileSystemWatcherEngine::run() break; } } else { + QMutexLocker locker(&mutex); + int id = fd; QString path = idToPath.value(id); if (path.isEmpty()) { @@ -290,12 +287,12 @@ void QKqueueFileSystemWatcherEngine::run() path = idToPath.value(id); if (path.isEmpty()) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching"; - goto process_next_event; + continue; } } if (kev.filter != EVFILT_VNODE) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter"; - goto process_next_event; + continue; } if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) { @@ -318,11 +315,7 @@ void QKqueueFileSystemWatcherEngine::run() emit fileChanged(path, false); } } - - // are there any more? -process_next_event: - r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout); - } while (r > 0); + } } } -- cgit v0.12 From b3b1ddf6f8dca6fa12817c74298ed9c80e173c7c Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:11 +0100 Subject: QKqueueFileSystemWatcherEngine: Use higher file descriptors. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A file descriptor is used for every path to be monitored, but descriptors below FD_SETSIZE (typically 1024) are precious, for use with select(2). To allow the application (and other parts of Qt) to use select(2), try to duplicate the descriptor returned by open(2) above FD_SETSIZE and close(2) the original. However, only do so when the descriptor table is already fairly large (FD_SETSIZE / 2). This keeps the descriptor table small for applications that use only a few descriptors. While here, also set the close-on-exec flag on the (new) descriptor. Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 29cd111..242c153 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -136,6 +136,14 @@ QStringList QKqueueFileSystemWatcherEngine::addPaths(const QStringList &paths, perror("QKqueueFileSystemWatcherEngine::addPaths: open"); continue; } + if (fd >= (int)FD_SETSIZE / 2 && fd < (int)FD_SETSIZE) { + int fddup = fcntl(fd, F_DUPFD, FD_SETSIZE); + if (fddup != -1) { + ::close(fd); + fd = fddup; + } + } + fcntl(fd, F_SETFD, FD_CLOEXEC); QT_STATBUF st; if (QT_FSTAT(fd, &st) == -1) { -- cgit v0.12 From 58020d06ed5b3e7e429454e4dc267b4713a70d08 Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:12 +0100 Subject: QPollingFileSystemWatcherEngine: Fix double report of directory change. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The polling engine first retrieves a QFileInfo for a given path, then tests whether it's different from before and if so, stores the new file info and emits a signal. In case path is a directory the test also checks if the list of directory entries has changed. This creates a window between retrieving the file info and the test in which a file can be added/removed from the directory or the directory itself can be removed. In that case the test returns true, because the list of entries has changed, but outdated file info is stored which means that on the next timeout the same change will be reported a second time. Therefore, refresh the file info after the test for changes. Merge-request: 2425 Reviewed-by: João Abecasis --- src/corelib/io/qfilesystemwatcher.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp index 3a7d795..4d0d495 100644 --- a/src/corelib/io/qfilesystemwatcher.cpp +++ b/src/corelib/io/qfilesystemwatcher.cpp @@ -228,8 +228,14 @@ void QPollingFileSystemWatcherEngine::timeout() dit.remove(); emit directoryChanged(path, true); } else if (x.value() != fi) { - x.value() = fi; - emit directoryChanged(path, false); + fi.refresh(); + if (!fi.exists()) { + dit.remove(); + emit directoryChanged(path, true); + } else { + x.value() = fi; + emit directoryChanged(path, false); + } } } -- cgit v0.12 From fa2efd76019332e477f1117e3338d6f17c881968 Mon Sep 17 00:00:00 2001 From: Tijl Coosemans Date: Fri, 26 Nov 2010 10:11:13 +0100 Subject: tst_QFileSystemWatcher: Don't exit the event loop on first signal. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sometimes tests can produce more than one signal and other times more than one signal would be an error. In order to test this the event loop should run long enough and not quit on the first signal. This is especially important on multicore systems where the application and worker threads run on different CPUs. Signals emitted by the worker thread are then almost immediately processed by the application thread. Merge-request: 2425 Reviewed-by: João Abecasis --- tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index fd898ee..82a6f88 100644 --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -141,10 +141,6 @@ void tst_QFileSystemWatcher::basicTest() QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(const QString &))); QEventLoop eventLoop; - connect(&watcher, - SIGNAL(fileChanged(const QString &)), - &eventLoop, - SLOT(quit())); QTimer timer; connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit())); @@ -280,10 +276,6 @@ void tst_QFileSystemWatcher::watchDirectory() QSignalSpy changedSpy(&watcher, SIGNAL(directoryChanged(const QString &))); QEventLoop eventLoop; - connect(&watcher, - SIGNAL(directoryChanged(const QString &)), - &eventLoop, - SLOT(quit())); QTimer timer; connect(&timer, SIGNAL(timeout()), &eventLoop, SLOT(quit())); -- cgit v0.12 From 9cadcb33ee35750d88ac11eee07b630bd8aa9c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Nov 2010 10:11:14 +0100 Subject: Fix QSettings auto test to use QTRY_VERIFY ... instead of relying on qApp->processEvents. Reviewed-by: Olivier Goffart --- tests/auto/qsettings/tst_qsettings.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tests/auto/qsettings/tst_qsettings.cpp b/tests/auto/qsettings/tst_qsettings.cpp index 0395eff..0813e28 100644 --- a/tests/auto/qsettings/tst_qsettings.cpp +++ b/tests/auto/qsettings/tst_qsettings.cpp @@ -51,6 +51,7 @@ #include #include #include +#include "../../shared/util.h" #if !defined(Q_OS_SYMBIAN) # include @@ -1726,26 +1727,22 @@ void tst_QSettings::testUpdateRequestEvent() settings1.setValue("key1", 1); QVERIFY(QFileInfo("foo").size() == 0); - qApp->processEvents(); - QVERIFY(QFileInfo("foo").size() > 0); + QTRY_VERIFY(QFileInfo("foo").size() > 0); settings1.remove("key1"); QVERIFY(QFileInfo("foo").size() > 0); - qApp->processEvents(); - QVERIFY(QFileInfo("foo").size() == 0); + QTRY_VERIFY(QFileInfo("foo").size() == 0); settings1.setValue("key2", 2); QVERIFY(QFileInfo("foo").size() == 0); - qApp->processEvents(); - QVERIFY(QFileInfo("foo").size() > 0); + QTRY_VERIFY(QFileInfo("foo").size() > 0); settings1.clear(); QVERIFY(QFileInfo("foo").size() > 0); - qApp->processEvents(); - QVERIFY(QFileInfo("foo").size() == 0); + QTRY_VERIFY(QFileInfo("foo").size() == 0); } const int NumIterations = 5; -- cgit v0.12 From 8d01c4a29b6b07a52f0aead33f108dac9e298a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Fri, 26 Nov 2010 10:11:15 +0100 Subject: QFileSystemWatcher: don't try to stop non-running thread Task-Number: QTBUG-14435 Reviewed-by: Bradley T. Hughes --- src/corelib/io/qfilesystemwatcher_kqueue.cpp | 2 ++ tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp | 1 + 2 files changed, 3 insertions(+) diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 242c153..68994d2 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -208,6 +208,8 @@ QStringList QKqueueFileSystemWatcherEngine::removePaths(const QStringList &paths QStringList p = paths; { QMutexLocker locker(&mutex); + if (pathToID.isEmpty()) + return p; QMutableListIterator it(p); while (it.hasNext()) { diff --git a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 82a6f88..648b7e9 100644 --- a/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -137,6 +137,7 @@ void tst_QFileSystemWatcher::basicTest() // create watcher, forcing it to use a specific backend QFileSystemWatcher watcher; watcher.setObjectName(QLatin1String("_qt_autotest_force_engine_") + backend); + watcher.removePath(testFile.fileName()); watcher.addPath(testFile.fileName()); QSignalSpy changedSpy(&watcher, SIGNAL(fileChanged(const QString &))); -- cgit v0.12 From 074c54a8d7faf6a97107f8573773f6817e567f2f Mon Sep 17 00:00:00 2001 From: axis Date: Fri, 26 Nov 2010 10:44:00 +0100 Subject: Corrected case on Symbian library. RevBy: Trust me --- src/gui/dialogs/dialogs.pri | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/dialogs.pri b/src/gui/dialogs/dialogs.pri index fc1ea9e..6ba707c 100644 --- a/src/gui/dialogs/dialogs.pri +++ b/src/gui/dialogs/dialogs.pri @@ -109,7 +109,7 @@ SOURCES += \ dialogs/qprintpreviewdialog.cpp symbian:contains(QT_CONFIG, s60) { - LIBS += -lcommondialogs + LIBS += -lCommonDialogs SOURCES += dialogs/qfiledialog_symbian.cpp \ dialogs/qcolordialog_symbian.cpp } -- cgit v0.12 From 7643d1016a6b4776cf671bbc595ec83002d2cc4e Mon Sep 17 00:00:00 2001 From: Arvid Ephraim Picciani Date: Fri, 26 Nov 2010 10:49:33 +0100 Subject: Remove gdb_dwarf_index from maemo mkspec maemo6 has gdb7.2 but not gdb-index --- mkspecs/linux-g++-maemo/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index 23f1f71..56f41c0 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -5,7 +5,7 @@ MAKEFILE_GENERATOR = UNIX TARGET_PLATFORM = unix TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index +CONFIG += qt warn_on release incremental link_prl CONFIG += nostrip QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -- cgit v0.12 From 32b8c1cd7042aadc02dc3770b25d794d673af44f Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 26 Nov 2010 09:56:47 +0100 Subject: Added mipmap property to QGLFramebufferObjectFormat. If the mipmap property is set, QGLFramebufferObject will allocate memory for mipmap levels. Reviewed-by: Gunnar --- src/opengl/qglframebufferobject.cpp | 40 ++++++++++++++++++++++++++++++++++--- src/opengl/qglframebufferobject.h | 3 +++ src/opengl/qglframebufferobject_p.h | 13 ++++++++---- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index 8915b5e..a7e81b2 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -202,6 +202,35 @@ int QGLFramebufferObjectFormat::samples() const } /*! + \since 4.8 + + Enables or disables mipmapping. Mipmapping is disabled by default. + If mipmapping is enabled, additional memory will be allocated for + the mipmap levels. The mipmap levels can be updated by binding the + texture and calling glGenerateMipmap(). Mipmapping cannot be enabled + for multisampled framebuffer objects. + + \sa mipmap(), texture() +*/ +void QGLFramebufferObjectFormat::setMipmap(bool enabled) +{ + detach(); + d->mipmap = enabled; +} + +/*! + \since 4.8 + + Returns true if mipmapping is enabled. + + \sa setMipmap() +*/ +bool QGLFramebufferObjectFormat::mipmap() const +{ + return d->mipmap; +} + +/*! Sets the attachment configuration of a framebuffer object to \a attachment. \sa attachment() @@ -398,7 +427,8 @@ bool QGLFramebufferObjectPrivate::checkFramebufferStatus() const void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, QGLFramebufferObject::Attachment attachment, - GLenum texture_target, GLenum internal_format, GLint samples) + GLenum texture_target, GLenum internal_format, + GLint samples, bool mipmap) { QGLContext *ctx = const_cast(QGLContext::currentContext()); fbo_guard.setContext(ctx); @@ -426,6 +456,8 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, glBindTexture(target, texture); glTexImage2D(target, 0, internal_format, size.width(), size.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + if (mipmap) + glGenerateMipmap(GL_TEXTURE_2D); #ifndef QT_OPENGL_ES glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_NEAREST); @@ -446,6 +478,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, color_buffer = 0; } else { + mipmap = false; GLint maxSamples; glGetIntegerv(GL_MAX_SAMPLES_EXT, &maxSamples); @@ -606,6 +639,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, format.setSamples(int(samples)); format.setAttachment(fbo_attachment); format.setInternalTextureFormat(internal_format); + format.setMipmap(mipmap); } /*! @@ -777,7 +811,7 @@ QGLFramebufferObject::QGLFramebufferObject(const QSize &size, const QGLFramebuff { Q_D(QGLFramebufferObject); d->init(this, size, format.attachment(), format.textureTarget(), format.internalTextureFormat(), - format.samples()); + format.samples(), format.mipmap()); } /*! \overload @@ -791,7 +825,7 @@ QGLFramebufferObject::QGLFramebufferObject(int width, int height, const QGLFrame { Q_D(QGLFramebufferObject); d->init(this, QSize(width, height), format.attachment(), format.textureTarget(), - format.internalTextureFormat(), format.samples()); + format.internalTextureFormat(), format.samples(), format.mipmap()); } #ifdef Q_MAC_COMPAT_GL_FUNCTIONS diff --git a/src/opengl/qglframebufferobject.h b/src/opengl/qglframebufferobject.h index 6ff6645..70d6eb2 100644 --- a/src/opengl/qglframebufferobject.h +++ b/src/opengl/qglframebufferobject.h @@ -148,6 +148,9 @@ public: void setSamples(int samples); int samples() const; + void setMipmap(bool enabled); + bool mipmap() const; + void setAttachment(QGLFramebufferObject::Attachment attachment); QGLFramebufferObject::Attachment attachment() const; diff --git a/src/opengl/qglframebufferobject_p.h b/src/opengl/qglframebufferobject_p.h index 58b4e9e..3738780 100644 --- a/src/opengl/qglframebufferobject_p.h +++ b/src/opengl/qglframebufferobject_p.h @@ -77,7 +77,8 @@ public: samples(0), attachment(QGLFramebufferObject::NoAttachment), target(GL_TEXTURE_2D), - internal_format(DEFAULT_FORMAT) + internal_format(DEFAULT_FORMAT), + mipmap(false) { } QGLFramebufferObjectFormatPrivate @@ -86,7 +87,8 @@ public: samples(other->samples), attachment(other->attachment), target(other->target), - internal_format(other->internal_format) + internal_format(other->internal_format), + mipmap(other->mipmap) { } bool equals(const QGLFramebufferObjectFormatPrivate *other) @@ -94,7 +96,8 @@ public: return samples == other->samples && attachment == other->attachment && target == other->target && - internal_format == other->internal_format; + internal_format == other->internal_format && + mipmap == other->mipmap; } QAtomicInt ref; @@ -102,6 +105,7 @@ public: QGLFramebufferObject::Attachment attachment; GLenum target; GLenum internal_format; + uint mipmap : 1; }; class QGLFBOGLPaintDevice : public QGLPaintDevice @@ -132,7 +136,8 @@ public: void init(QGLFramebufferObject *q, const QSize& sz, QGLFramebufferObject::Attachment attachment, - GLenum internal_format, GLenum texture_target, GLint samples = 0); + GLenum internal_format, GLenum texture_target, + GLint samples = 0, bool mipmap = false); bool checkFramebufferStatus() const; QGLSharedResourceGuard fbo_guard; GLuint texture; -- cgit v0.12 From 1b218eafc973d14ab7a6db7bfa4ed18b5978c99b Mon Sep 17 00:00:00 2001 From: Kim Motoyoshi Kalland Date: Fri, 26 Nov 2010 12:10:54 +0100 Subject: Line ending fix. --- .../qmlvisual/webview/flickable/flickweb.qml | 70 +++++++++++----------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/tests/auto/declarative/qmlvisual/webview/flickable/flickweb.qml b/tests/auto/declarative/qmlvisual/webview/flickable/flickweb.qml index 6063226..af09389 100644 --- a/tests/auto/declarative/qmlvisual/webview/flickable/flickweb.qml +++ b/tests/auto/declarative/qmlvisual/webview/flickable/flickweb.qml @@ -1,35 +1,35 @@ -import QtQuick 1.0 -import QtWebKit 1.0 - -Flickable { - id: flickable - width: 320 - height: 200 - contentWidth: Math.max(flickable.width,webView.width) - contentHeight: Math.max(flickable.height,webView.height) - pressDelay: 100 - - WebView { - id: webView - transformOrigin: Item.TopLeft - smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions - url: "test.html" - preferredWidth: flickable.width - preferredHeight: flickable.height - contentsScale: 1 - onContentsSizeChanged: { - // zoom out - contentsScale = Math.min(1,flickable.width / contentsSize.width) - } - } - - Rectangle { - id: button - width: 50; height: 50; color: "red" - MouseArea { - anchors.fill: parent - onPressed: button.color = "blue" - onReleased: button.color = "green" - } - } -} +import QtQuick 1.0 +import QtWebKit 1.0 + +Flickable { + id: flickable + width: 320 + height: 200 + contentWidth: Math.max(flickable.width,webView.width) + contentHeight: Math.max(flickable.height,webView.height) + pressDelay: 100 + + WebView { + id: webView + transformOrigin: Item.TopLeft + smooth: false // We don't want smooth scaling, since we only scale during (fast) transitions + url: "test.html" + preferredWidth: flickable.width + preferredHeight: flickable.height + contentsScale: 1 + onContentsSizeChanged: { + // zoom out + contentsScale = Math.min(1,flickable.width / contentsSize.width) + } + } + + Rectangle { + id: button + width: 50; height: 50; color: "red" + MouseArea { + anchors.fill: parent + onPressed: button.color = "blue" + onReleased: button.color = "green" + } + } +} -- cgit v0.12 From f9433e9bb5a4eb849860d5eb29c9380e349b6aa9 Mon Sep 17 00:00:00 2001 From: Arvid Ephraim Picciani Date: Fri, 26 Nov 2010 13:43:40 +0100 Subject: Revert "Remove gdb_dwarf_index from maemo mkspec" This reverts commit 7643d1016a6b4776cf671bbc595ec83002d2cc4e. --- mkspecs/linux-g++-maemo/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf index 56f41c0..23f1f71 100644 --- a/mkspecs/linux-g++-maemo/qmake.conf +++ b/mkspecs/linux-g++-maemo/qmake.conf @@ -5,7 +5,7 @@ MAKEFILE_GENERATOR = UNIX TARGET_PLATFORM = unix TEMPLATE = app -CONFIG += qt warn_on release incremental link_prl +CONFIG += qt warn_on release incremental link_prl gdb_dwarf_index CONFIG += nostrip QT += core gui QMAKE_INCREMENTAL_STYLE = sublib -- cgit v0.12 From 45180cb6e3d92d7bb6ac22515f6cd00206b6fac8 Mon Sep 17 00:00:00 2001 From: Arvid Ephraim Picciani Date: Fri, 26 Nov 2010 13:44:43 +0100 Subject: gdb_dwarf_index: change version constraint from 72 to 73 We previously made the false assumption that gdb 7.2 matches sourceware master (which claims to be 7.2, but really is 7.3) --- mkspecs/features/unix/gdb_dwarf_index.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/unix/gdb_dwarf_index.prf b/mkspecs/features/unix/gdb_dwarf_index.prf index e2167a6..c647bae 100644 --- a/mkspecs/features/unix/gdb_dwarf_index.prf +++ b/mkspecs/features/unix/gdb_dwarf_index.prf @@ -1,7 +1,7 @@ !CONFIG(separate_debug_info):CONFIG(debug, debug|release):!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) { QMAKE_GDB_INDEX = { test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\"; } && \ - test \$\$(gdb --version | sed -e \'s,[^(]*(GDB).\\([0-9]\\)\\.\\([0-9]\\).*,\\1\\2,;q\') -gt 71 && \ + test \$\$(gdb --version | sed -e \'s,[^(]*(GDB).\\([0-9]\\)\\.\\([0-9]\\).*,\\1\\2,;q\') -gt 72 && \ gdb --nx --batch --quiet -ex \'set confirm off\' -ex \'save gdb-index .\' -ex quit \'$(TARGET)\' && \ test -f $(TARGET).gdb-index && \ $$QMAKE_OBJCOPY --add-section \'.gdb_index=$(TARGET).gdb-index\' --set-section-flags \'.gdb_index=readonly\' \'$(TARGET)\' \'$(TARGET)\' && \ -- cgit v0.12