diff options
author | ninerider <qt-info@nokia.com> | 2009-11-23 12:28:19 (GMT) |
---|---|---|
committer | ninerider <qt-info@nokia.com> | 2009-11-23 12:28:19 (GMT) |
commit | 4cfc3a884835667fe8c3a6aa745dc4ace34794e4 (patch) | |
tree | 553a33b8112750d1d2dd7dc503c9c70391538b07 /src | |
parent | cda63c368dbb5acd040e2190db8f25de69462d8e (diff) | |
parent | 4112771f56e827d1d8fbde0995ebf5b0242c01a8 (diff) | |
download | Qt-4cfc3a884835667fe8c3a6aa745dc4ace34794e4.zip Qt-4cfc3a884835667fe8c3a6aa745dc4ace34794e4.tar.gz Qt-4cfc3a884835667fe8c3a6aa745dc4ace34794e4.tar.bz2 |
Merge remote branch 'origin/4.6' into 4.6-ce
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfsfileengine_unix.cpp | 2 | ||||
-rw-r--r-- | src/corelib/io/qiodevice.cpp | 6 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem.cpp | 2 | ||||
-rw-r--r-- | src/gui/image/qnativeimage.cpp | 2 | ||||
-rw-r--r-- | src/gui/itemviews/qtableview.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qcocoaview_mac.mm | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwidget.cpp | 5 | ||||
-rw-r--r-- | src/gui/kernel/qwidget_x11.cpp | 7 | ||||
-rw-r--r-- | src/gui/widgets/qtabbar.cpp | 4 | ||||
-rw-r--r-- | src/gui/widgets/qtabbar_p.h | 3 | ||||
-rw-r--r-- | src/gui/widgets/qtoolbararealayout_p.h | 2 | ||||
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 28 | ||||
-rw-r--r-- | src/openvg/qpaintengine_vg_p.h | 2 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vg.cpp | 14 |
14 files changed, 67 insertions, 14 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp index 05e6fab..35737b3 100644 --- a/src/corelib/io/qfsfileengine_unix.cpp +++ b/src/corelib/io/qfsfileengine_unix.cpp @@ -1254,7 +1254,7 @@ uchar *QFSFileEnginePrivate::map(qint64 offset, qint64 size, QFile::MemoryMapFla // undefined behavior. Otherwise, let mmap have its say. if (doStat() && (QT_OFF_T(size) > st.st_size - QT_OFF_T(offset))) - return 0; + qWarning("QFSFileEngine::map: Mapping a file beyond its size is not portable"); int access = 0; if (openMode & QIODevice::ReadOnly) access |= PROT_READ; diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp index b84961f..0e5a2de 100644 --- a/src/corelib/io/qiodevice.cpp +++ b/src/corelib/io/qiodevice.cpp @@ -1157,6 +1157,10 @@ QByteArray QIODevice::readLine(qint64 maxSize) // If resize fails or maxSize == 0, read incrementally if (maxSize == 0) maxSize = INT_MAX; + + // The first iteration needs to leave an extra byte for the terminating null + result.resize(1); + qint64 readResult; do { result.resize(int(qMin(maxSize, result.size() + QIODEVICE_BUFFERSIZE))); @@ -1164,7 +1168,7 @@ QByteArray QIODevice::readLine(qint64 maxSize) if (readResult > 0 || readBytes == 0) readBytes += readResult; } while (readResult == QIODEVICE_BUFFERSIZE - && result[int(readBytes)] != '\n'); + && result[int(readBytes - 1)] != '\n'); } else readBytes = readLine(result.data(), result.size()); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 3f6dff2..710048e 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1240,7 +1240,7 @@ void QGraphicsItemPrivate::initStyleOption(QStyleOptionGraphicsItem *option, con const QTransform reverseMap = worldTransform.inverted(); const QVector<QRect> exposedRects(exposedRegion.rects()); for (int i = 0; i < exposedRects.size(); ++i) { - option->exposedRect |= reverseMap.mapRect(exposedRects.at(i)); + option->exposedRect |= reverseMap.mapRect(QRectF(exposedRects.at(i))); if (option->exposedRect.contains(brect)) break; } diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index e4ea2e9..3b43ab6 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -178,6 +178,8 @@ QNativeImage::QNativeImage(int width, int height, QImage::Format format,bool /* if (ok) { xshmimg->data = (char*)shmat(xshminfo.shmid, 0, 0); xshminfo.shmaddr = xshmimg->data; + if (shmctl(xshminfo.shmid, IPC_RMID, 0) == -1) + qWarning() << "Error while marking the shared memory segment to be destroyed"; ok = (xshminfo.shmaddr != (char*)-1); if (ok) image = QImage((uchar *)xshmimg->data, width, height, systemFormat()); diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index a3877b7..d27e693 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -114,7 +114,7 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) } } else if (old_height > span->height()) { //remove the span from all the subspans lists that intersect the columns not covered anymore - Index::iterator it_y = index.lowerBound(-span->bottom()); + Index::iterator it_y = index.lowerBound(qMin(-span->bottom(), 0)); Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->top() + old_height -1) { if (-it_y.key() > span->bottom()) { diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index a16d1f8..72eedad 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -1451,7 +1451,7 @@ Qt::DropAction QDragManager::drag(QDrag *o) [image release]; dragPrivate()->executed_action = Qt::IgnoreAction; object = 0; - Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams.performedAction)); + Qt::DropAction performedAction(qt_mac_mapNSDragOperation(qMacDnDParams()->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/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 709f6f3..fbb9115 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -8248,7 +8248,8 @@ bool QWidget::event(QEvent *event) QList<QObject*> childList = d->children; for (int i = 0; i < childList.size(); ++i) { QObject *o = childList.at(i); - QApplication::sendEvent(o, event); + if (o) + QApplication::sendEvent(o, event); } } update(); @@ -8277,7 +8278,7 @@ bool QWidget::event(QEvent *event) QList<QObject*> childList = d->children; for (int i = 0; i < childList.size(); ++i) { QObject *o = childList.at(i); - if (o != QApplication::activeModalWidget()) { + if (o && o != QApplication::activeModalWidget()) { if (qobject_cast<QWidget *>(o) && static_cast<QWidget *>(o)->isWindow()) { // do not forward the event to child windows, // QApplication does this for us diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp index 7461637..0bc9cbc 100644 --- a/src/gui/kernel/qwidget_x11.cpp +++ b/src/gui/kernel/qwidget_x11.cpp @@ -527,8 +527,13 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO QX11InfoData *xd = &X11->screens[qt_x11_create_desktop_on_screen]; xinfo.setX11Data(xd); } else if (parentXinfo && (parentXinfo->screen() != xinfo.screen() - || parentXinfo->visual() != xinfo.visual())) + || (parentXinfo->visual() != xinfo.visual() + && !q->inherits("QGLWidget")))) { + // QGLWidgets have to be excluded here as they have a + // specially crafted QX11Info structure which can't be swapped + // out with the parent widgets QX11Info. The parent visual, + // for instance, might not even be GL capable. xinfo = *parentXinfo; } diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp index 3935c55..8ef6017 100644 --- a/src/gui/widgets/qtabbar.cpp +++ b/src/gui/widgets/qtabbar.cpp @@ -1948,7 +1948,8 @@ void QTabBar::changeEvent(QEvent *event) Q_D(QTabBar); if (event->type() == QEvent::StyleChange) { d->elideMode = Qt::TextElideMode(style()->styleHint(QStyle::SH_TabBar_ElideMode, 0, this)); - d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); + if (!d->useScrollButtonsSetByUser) + d->useScrollButtons = !style()->styleHint(QStyle::SH_TabBar_PreferNoArrows, 0, this); d->refresh(); } else if (event->type() == QEvent::FontChange) { d->refresh(); @@ -2003,6 +2004,7 @@ bool QTabBar::usesScrollButtons() const void QTabBar::setUsesScrollButtons(bool useButtons) { Q_D(QTabBar); + d->useScrollButtonsSetByUser = true; if (d->useScrollButtons == useButtons) return; d->useScrollButtons = useButtons; diff --git a/src/gui/widgets/qtabbar_p.h b/src/gui/widgets/qtabbar_p.h index 9f3285b..2e8fb6d 100644 --- a/src/gui/widgets/qtabbar_p.h +++ b/src/gui/widgets/qtabbar_p.h @@ -75,7 +75,7 @@ class QTabBarPrivate : public QWidgetPrivate public: QTabBarPrivate() :currentIndex(-1), pressedIndex(-1), shape(QTabBar::RoundedNorth), layoutDirty(false), - drawBase(true), scrollOffset(0), expanding(true), closeButtonOnTabs(false), + drawBase(true), scrollOffset(0), useScrollButtonsSetByUser(false) , expanding(true), closeButtonOnTabs(false), selectionBehaviorOnRemove(QTabBar::SelectRightTab), paintWithOffsets(true), movable(false), dragInProgress(false), documentMode(false), movingTab(0) #ifdef Q_WS_MAC @@ -187,6 +187,7 @@ public: QSize iconSize; Qt::TextElideMode elideMode; bool useScrollButtons; + bool useScrollButtonsSetByUser; bool expanding; bool closeButtonOnTabs; diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h index f0ab80c..134e95a 100644 --- a/src/gui/widgets/qtoolbararealayout_p.h +++ b/src/gui/widgets/qtoolbararealayout_p.h @@ -118,7 +118,7 @@ public: void extendSize(Qt::Orientation o, int extent) { - int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : size) + extent); + int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : pick(o, sizeHint())) + extent); int sizeh = pick(o, sizeHint()); if (newSize == sizeh) { preferredSize = -1; diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 75b7fa5..fda4b10 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -3407,6 +3407,34 @@ void QVGPaintEngine::restoreState(QPaintEngine::DirtyFlags dirty) #endif } +void QVGPaintEngine::fillRegion + (const QRegion& region, const QColor& color, const QSize& surfaceSize) +{ + Q_D(QVGPaintEngine); + if (d->clearColor != color || d->clearOpacity != 1.0f) { + VGfloat values[4]; + values[0] = color.redF(); + values[1] = color.greenF(); + values[2] = color.blueF(); + values[3] = color.alphaF(); + vgSetfv(VG_CLEAR_COLOR, 4, values); + d->clearColor = color; + d->clearOpacity = 1.0f; + } + if (region.rectCount() == 1) { + QRect r = region.boundingRect(); + vgClear(r.x(), surfaceSize.height() - r.y() - r.height(), + r.width(), r.height()); + } else { + const QVector<QRect> rects = region.rects(); + for (int i = 0; i < rects.size(); ++i) { + QRect r = rects.at(i); + vgClear(r.x(), surfaceSize.height() - r.y() - r.height(), + r.width(), r.height()); + } + } +} + #if !defined(QVG_NO_SINGLE_CONTEXT) && !defined(QT_NO_EGL) QVGCompositionHelper::QVGCompositionHelper() diff --git a/src/openvg/qpaintengine_vg_p.h b/src/openvg/qpaintengine_vg_p.h index 1202b55..86a522a 100644 --- a/src/openvg/qpaintengine_vg_p.h +++ b/src/openvg/qpaintengine_vg_p.h @@ -151,6 +151,8 @@ public: QVGPaintEnginePrivate *vgPrivate() { Q_D(QVGPaintEngine); return d; } + void fillRegion(const QRegion& region, const QColor& color, const QSize& surfaceSize); + protected: QVGPaintEngine(QVGPaintEnginePrivate &data); diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index f8486a6..a1301e3 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -48,6 +48,7 @@ #if !defined(QT_NO_EGL) #include <QtGui/private/qegl_p.h> +#include <QtGui/private/qwidget_p.h> QT_BEGIN_NAMESPACE @@ -71,7 +72,6 @@ QVGWindowSurface::~QVGWindowSurface() QPaintDevice *QVGWindowSurface::paintDevice() { - d_ptr->beginPaint(window()); return this; } @@ -94,8 +94,16 @@ bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy) void QVGWindowSurface::beginPaint(const QRegion ®ion) { - // Nothing to do here. - Q_UNUSED(region); + d_ptr->beginPaint(window()); + + // If the window is not opaque, then fill the region we are about + // to paint with the transparent color. + if (!qt_widget_private(window())->isOpaque && + window()->testAttribute(Qt::WA_TranslucentBackground)) { + QVGPaintEngine *engine = static_cast<QVGPaintEngine *> + (d_ptr->paintEngine()); + engine->fillRegion(region, Qt::transparent, d_ptr->surfaceSize()); + } } void QVGWindowSurface::endPaint(const QRegion ®ion) |