diff options
Diffstat (limited to 'src/gui')
33 files changed, 166 insertions, 78 deletions
diff --git a/src/gui/accessible/qaccessible_mac_cocoa.mm b/src/gui/accessible/qaccessible_mac_cocoa.mm index 1688404..ada927e 100644 --- a/src/gui/accessible/qaccessible_mac_cocoa.mm +++ b/src/gui/accessible/qaccessible_mac_cocoa.mm @@ -58,11 +58,15 @@ QT_BEGIN_NAMESPACE //#define MAC_ACCESSIBILTY_DEVELOPER_MODE +#ifndef QT_NO_DEBUG_STREAM #ifdef MAC_ACCESSIBILTY_DEVELOPER_MODE #define MAC_ACCESSIBILTY_DEBUG QT_PREPEND_NAMESPACE(qDebug) #else #define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(qDebug) #endif +#else +#define MAC_ACCESSIBILTY_DEBUG if (0) QT_PREPEND_NAMESPACE(QNoDebug) +#endif typedef QMap<QAccessible::Role, NSString *> QMacAccessibiltyRoleMap; Q_GLOBAL_STATIC(QMacAccessibiltyRoleMap, qMacAccessibiltyRoleMap); diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index 5e4e49e..0029017 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -488,13 +488,10 @@ void QGraphicsEffect::setEnabled(bool enable) */ /*! - Schedules a redraw of the source. Call this function whenever the source - needs to be redrawn. - - This convenience function is equivalent to calling - QGraphicsEffectSource::update(). + Schedules a redraw of the effect. Call this function whenever the effect + needs to be redrawn. This function does not trigger a redraw of the source. - \sa updateBoundingRect(), QGraphicsEffectSource::update() + \sa updateBoundingRect() */ void QGraphicsEffect::update() { diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 969acc4..fea6e8d 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -415,7 +415,10 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig config, const QEg // At this point, the widget's window should be created and have the correct visual. Now we // just need to create the EGL surface for it: - return eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0); + EGLSurface surf = eglCreateWindowSurface(QEgl::display(), config, (EGLNativeWindowType)widget->winId(), 0); + if (surf == EGL_NO_SURFACE) + qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", eglGetError()); + return surf; } if (x11PixmapData) { diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 2de3638..61285d2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -411,6 +411,11 @@ these notifications are disabled by default. You must enable this flag to receive notifications for scene position changes. This flag was introduced in Qt 4.6. + + \omitvalue ItemStopsClickFocusPropagation \omit The item stops propagating + click focus to items underneath when being clicked on. This flag + allows you create a non-focusable item that can be clicked on without + changing the focus. \endomit */ /*! @@ -11432,6 +11437,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemSendsScenePositionChanges: str = "ItemSendsScenePositionChanges"; break; + case QGraphicsItem::ItemStopsClickFocusPropagation: + str = "ItemStopsClickFocusPropagation"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index d7d5332..3c193cd 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -106,7 +106,8 @@ public: ItemNegativeZStacksBehindParent = 0x2000, ItemIsPanel = 0x4000, ItemIsFocusScope = 0x8000, // internal - ItemSendsScenePositionChanges = 0x10000 + ItemSendsScenePositionChanges = 0x10000, + ItemStopsClickFocusPropagation = 0x20000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index bde6e7d..f9f5d3d 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -556,7 +556,7 @@ public: quint32 dirtyChildrenBoundingRect : 1; // Packed 32 bits - quint32 flags : 17; + quint32 flags : 18; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; @@ -571,9 +571,9 @@ public: quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; quint32 mouseSetsFocus : 1; - quint32 explicitActivate : 1; // New 32 bits + quint32 explicitActivate : 1; quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; quint32 sequentialOrdering : 1; @@ -582,7 +582,7 @@ public: quint32 pendingPolish : 1; quint32 mayHaveChildWithGraphicsEffect : 1; quint32 isDeclarativeItem : 1; - quint32 padding : 24; + quint32 padding : 23; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index ca3b56f..d04074a 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1336,6 +1336,8 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou break; } } + if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) + break; if (item->isPanel()) break; } diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index fd2c139..ef9be8f 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -2018,7 +2018,7 @@ void QPixmap::detach() the color table. If this is too expensive an operation, you can use QBitmap::fromImage() instead. - \sa toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} + \sa fromImageReader(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} */ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) { @@ -2033,6 +2033,27 @@ QPixmap QPixmap::fromImage(const QImage &image, Qt::ImageConversionFlags flags) } /*! + \fn QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) + + Create a QPixmap from an image read directly from an \a imageReader. + The \a flags argument is a bitwise-OR of the \l{Qt::ImageConversionFlags}. + Passing 0 for \a flags sets all the default options. + + On some systems, reading an image directly to QPixmap can use less memory than + reading a QImage to convert it to QPixmap. + + \sa fromImage(), toImage(), {QPixmap#Pixmap Conversion}{Pixmap Conversion} +*/ +QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags) +{ + QGraphicsSystem *gs = QApplicationPrivate::graphicsSystem(); + QScopedPointer<QPixmapData> data(gs ? gs->createPixmapData(QPixmapData::PixmapType) + : QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixmapType)); + data->fromImageReader(imageReader, flags); + return QPixmap(data.take()); +} + +/*! \fn QPixmap QPixmap::grabWindow(WId window, int x, int y, int width, int height) diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index 82546da..64ca8a3 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -62,6 +62,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) class QImageWriter; +class QImageReader; class QColor; class QVariant; class QX11Info; @@ -134,6 +135,7 @@ public: QImage toImage() const; static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); + static QPixmap fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags = Qt::AutoColor); bool load(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); bool loadFromData(const uchar *buf, uint len, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index e188745..53f3559 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -152,6 +152,17 @@ void QRasterPixmapData::fromImage(const QImage &sourceImage, createPixmapForImage(image, flags, /* inplace = */false); } +void QRasterPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + Q_UNUSED(flags); + QImage image = imageReader->read(); + if (image.isNull()) + return; + + createPixmapForImage(image, flags, /* inplace = */true); +} + // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index a46e054..36a9b2f 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -74,6 +74,7 @@ public: void fromFile(const QString &filename, Qt::ImageConversionFlags flags); bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags); void fromImage(const QImage &image, Qt::ImageConversionFlags flags); + void fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags); void copy(const QPixmapData *data, const QRect &rect); bool scroll(int dx, int dy, const QRect &rect); diff --git a/src/gui/image/qpixmapdata.cpp b/src/gui/image/qpixmapdata.cpp index 345e3cf..ef1f6c4 100644 --- a/src/gui/image/qpixmapdata.cpp +++ b/src/gui/image/qpixmapdata.cpp @@ -124,6 +124,13 @@ static QImage makeBitmapCompliantIfNeeded(QPixmapData *d, const QImage &image, Q return image; } +void QPixmapData::fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags) +{ + const QImage image = imageReader->read(); + fromImage(image, flags); +} + bool QPixmapData::fromFile(const QString &fileName, const char *format, Qt::ImageConversionFlags flags) { diff --git a/src/gui/image/qpixmapdata_p.h b/src/gui/image/qpixmapdata_p.h index 9a1505a..ec62b0b 100644 --- a/src/gui/image/qpixmapdata_p.h +++ b/src/gui/image/qpixmapdata_p.h @@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE +class QImageReader; + class Q_GUI_EXPORT QPixmapData { public: @@ -83,6 +85,8 @@ public: virtual void resize(int width, int height) = 0; virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags) = 0; + virtual void fromImageReader(QImageReader *imageReader, + Qt::ImageConversionFlags flags); virtual bool fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 2a85fdc..ef719ca 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -3065,6 +3065,11 @@ bool QETWidget::translateMouseEvent(const MSG &msg) break; } } +#ifndef Q_OS_WINCE + static bool trackMouseEventLookup = false; + typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT); + static PtrTrackMouseEvent ptrTrackMouseEvent = 0; +#endif state = translateButtonState(msg.wParam, type, button); // button state const QPoint widgetPos = mapFromGlobal(QPoint(msg.pt.x, msg.pt.y)); QWidget *alienWidget = !internalWinId() ? this : childAt(widgetPos); @@ -3129,9 +3134,6 @@ bool QETWidget::translateMouseEvent(const MSG &msg) #ifndef Q_OS_WINCE if (curWin != 0) { - static bool trackMouseEventLookup = false; - typedef BOOL (WINAPI *PtrTrackMouseEvent)(LPTRACKMOUSEEVENT); - static PtrTrackMouseEvent ptrTrackMouseEvent = 0; if (!trackMouseEventLookup) { trackMouseEventLookup = true; ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent"); @@ -3245,6 +3247,21 @@ bool QETWidget::translateMouseEvent(const MSG &msg) qt_button_down = 0; } +#ifndef Q_OS_WINCE + if (type == QEvent::MouseButtonPress + && QApplication::activePopupWidget() != activePopupWidget + && ptrTrackMouseEvent + && curWin) { + // Since curWin is already the window we clicked on, + // we have to setup the mouse tracking here. + TRACKMOUSEEVENT tme; + tme.cbSize = sizeof(TRACKMOUSEEVENT); + tme.dwFlags = 0x00000002; // TME_LEAVE + tme.hwndTrack = curWin; // Track on window receiving msgs + tme.dwHoverTime = (DWORD)-1; // HOVER_DEFAULT + ptrTrackMouseEvent(&tme); + } +#endif if (type == QEvent::MouseButtonPress && QApplication::activePopupWidget() != activePopupWidget && replayPopupMouseEvent) { diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 3664743..e4d9848 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2155,7 +2155,7 @@ void qt_init(QApplicationPrivate *priv, int, X11->fc_scale = fc_scale; for (int s = 0; s < ScreenCount(X11->display); ++s) { int subpixel = FC_RGBA_UNKNOWN; -#if RENDER_MAJOR > 0 || RENDER_MINOR >= 6 +#if !defined(QT_NO_XRENDER) && (RENDER_MAJOR > 0 || RENDER_MINOR >= 6) if (X11->use_xrender) { int rsp = XRenderQuerySubpixelOrder(X11->display, s); switch (rsp) { diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp index 873b8f9..3dc6afc 100644 --- a/src/gui/kernel/qkeymapper_mac.cpp +++ b/src/gui/kernel/qkeymapper_mac.cpp @@ -866,14 +866,27 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e UInt32 macModifiers = 0; GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0, sizeof(macModifiers), 0, &macModifiers); +#ifdef QT_MAC_USE_COCOA + // The unicode characters in the range 0xF700-0xF747 are reserved + // by Mac OS X for transient use as keyboard function keys. We + // wont send 'text' for such key events. This is done to match + // behavior on other platforms. + unsigned int *unicodeKey = (unsigned int*)info; + if (*unicodeKey >= 0xf700 && *unicodeKey <= 0xf747) + text = QString(); + bool isAccepted; +#endif handled_event = QKeyMapper::sendKeyEvent(widget, grab, (ekind == kEventRawKeyUp) ? QEvent::KeyRelease : QEvent::KeyPress, qtKey, modifiers, text, ekind == kEventRawKeyRepeat, 0, macScanCode, macVirtualKey, macModifiers #ifdef QT_MAC_USE_COCOA - ,static_cast<bool *>(info) + ,&isAccepted #endif ); +#ifdef QT_MAC_USE_COCOA + *unicodeKey = (unsigned int)isAccepted; +#endif } return handled_event; } diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 8cef03c..3fc27f4 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -682,10 +682,12 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve NSEvent *event = static_cast<NSEvent *>(keyEvent); EventRef key_event = static_cast<EventRef>(const_cast<void *>([event eventRef])); Q_ASSERT(key_event); + unsigned int info = 0; if ([event type] == NSKeyDown) { NSString *characters = [event characters]; unichar value = [characters characterAtIndex:0]; qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value); + info = value; } // Redirect keys to alien widgets. @@ -701,9 +703,8 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve if (mustUseCocoaKeyEvent()) return qt_dispatchKeyEventWithCocoa(keyEvent, widgetToGetEvent); - bool isAccepted; - bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &isAccepted, true); - return consumed && isAccepted; + bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &info, true); + return consumed && (info != 0); #endif } diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 280712a..a9bb691 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2804,7 +2804,7 @@ void QWidgetPrivate::setSubWindowStacking(bool set) QList<QWidget *> widgets = q->findChildren<QWidget *>(); for (int i=0; i<widgets.size(); ++i) { QWidget *child = widgets.at(i); - if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created)) { + if (child->isWindow() && child->testAttribute(Qt::WA_WState_Created) && child->isVisibleTo(q)) { if (set) [qt_mac_window_for(q) addChildWindow:qt_mac_window_for(child) ordered:NSWindowAbove]; else diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 68f9470..3f351d9 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -738,9 +738,6 @@ void QWidgetPrivate::s60UpdateIsOpaque() if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) return; - if ((data.window_flags & Qt::FramelessWindowHint) == 0) - return; - RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow()); #ifdef Q_SYMBIAN_SEMITRANSPARENT_BG_SURFACE diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index 04fe825..6cd8688 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -299,7 +299,7 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl, void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixels, int length, uint const_alpha) { - Q_ASSERT(const_alpha > 0); // if const_alpha == 0, this should never be called + Q_ASSERT(const_alpha >= 0); Q_ASSERT(const_alpha < 256); const quint32 *src = (const quint32 *) srcPixels; diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index 2ea3d33..69ce47e 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -79,5 +79,9 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ return 0; } +QPixmapData *QGraphicsSystem::createPixmapData(QPixmapData *origin) +{ + return createPixmapData(origin->pixelType()); +} QT_END_NAMESPACE diff --git a/src/gui/painting/qgraphicssystem_p.h b/src/gui/painting/qgraphicssystem_p.h index ddca788..1211505 100644 --- a/src/gui/painting/qgraphicssystem_p.h +++ b/src/gui/painting/qgraphicssystem_p.h @@ -64,6 +64,7 @@ class Q_GUI_EXPORT QGraphicsSystem { public: virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; + virtual QPixmapData *createPixmapData(QPixmapData *origin); virtual QWindowSurface *createWindowSurface(QWidget *widget) const = 0; virtual ~QGraphicsSystem() = 0; diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 32a8578..1c3ae10 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -416,7 +416,7 @@ void QRuntimeGraphicsSystem::setGraphicsSystem(const QString &name) for (int i = 0; i < m_pixmapDatas.size(); ++i) { QRuntimePixmapData *proxy = m_pixmapDatas.at(i); - QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data->pixelType()); + QPixmapData *newData = m_graphicsSystem->createPixmapData(proxy->m_data); // ### TODO Optimize. Openvg and s60raster graphics systems could switch internal ARGB32_PRE QImage buffers. newData->fromImage(proxy->m_data->toImage(), Qt::AutoColor | Qt::OrderedAlphaDither); delete proxy->m_data; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 71bc990..2ea6673 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -5958,7 +5958,7 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice"); } - QTextItemInt gf(glyphs, &d->state->font, fontEngine); + QTextItemInt gf(glyphs, &d->state->font, str.data(), len, fontEngine); drawTextItem(p, gf); return; } diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 78553c9..a17b7c1 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -86,9 +86,11 @@ static qreal dot(const QPointF &a, const QPointF &b) return a.x() * b.x() + a.y() * b.y(); } -static QPointF normalize(const QPointF &p) +static void normalize(double &x, double &y) { - return p / qSqrt(p.x() * p.x() + p.y() * p.y()); + double reciprocal = 1 / qSqrt(x * x + y * y); + x *= reciprocal; + y *= reciprocal; } struct QIntersection @@ -1017,8 +1019,8 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const const QPathEdge *ap = edge(a); const QPathEdge *bp = edge(b); - qreal a_angle = ap->angle; - qreal b_angle = bp->angle; + double a_angle = ap->angle; + double b_angle = bp->angle; if (vertex == ap->second) a_angle = ap->invAngle; @@ -1026,7 +1028,7 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const if (vertex == bp->second) b_angle = bp->invAngle; - qreal result = b_angle - a_angle; + double result = b_angle - a_angle; if (result >= 128.) return result - 128.; @@ -1036,26 +1038,6 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const return result; } -static inline QPointF tangentAt(const QWingedEdge &list, int vi, int ei) -{ - const QPathEdge *ep = list.edge(ei); - Q_ASSERT(ep); - - qreal sign; - - if (ep->first == vi) { - sign = 1; - } else { - sign = -1; - } - - const QPointF a = *list.vertex(ep->first); - const QPointF b = *list.vertex(ep->second); - QPointF normal = b - a; - - return normalize(sign * normal); -} - static inline QPointF midPoint(const QWingedEdge &list, int ei) { const QPathEdge *ep = list.edge(ei); @@ -1191,7 +1173,7 @@ static int commonEdge(const QWingedEdge &list, int a, int b) return -1; } -static qreal computeAngle(const QPointF &v) +static double computeAngle(const QPointF &v) { #if 1 if (v.x() == 0) { @@ -1200,15 +1182,17 @@ static qreal computeAngle(const QPointF &v) return v.x() <= 0 ? 32. : 96.; } - QPointF nv = normalize(v); - if (nv.y() < 0) { - if (nv.x() < 0) { // 0 - 32 - return -32. * nv.x(); + double vx = v.x(); + double vy = v.y(); + normalize(vx, vy); + if (vy < 0) { + if (vx < 0) { // 0 - 32 + return -32. * vx; } else { // 96 - 128 - return 128. - 32. * nv.x(); + return 128. - 32. * vx; } } else { // 32 - 96 - return 64. + 32 * nv.x(); + return 64. + 32. * vx; } #else // doesn't seem to be robust enough diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index fab618d..bdad4e1 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -148,8 +148,8 @@ public: int first; int second; - qreal angle; - qreal invAngle; + double angle; + double invAngle; int next(Traversal traversal, Direction direction) const; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 4bb2ea8..2527662 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -50,17 +50,17 @@ #include "qapplication.h" #include <w32std.h> -#include <aknsconstants.h> +#include <AknsConstants.h> #include <aknconsts.h> -#include <aknsitemid.h> -#include <aknsutils.h> -#include <aknsdrawutils.h> -#include <aknsskininstance.h> -#include <aknsbasicbackgroundcontrolcontext.h> +#include <AknsItemID.h> +#include <AknsUtils.h> +#include <AknsDrawUtils.h> +#include <AknsSkinInstance.h> +#include <AknsBasicBackgroundControlContext.h> #include <avkon.mbg> #include <aknfontaccess.h> #include <aknlayoutfont.h> -#include <aknutils.h> +#include <AknUtils.h> #include <aknnavi.h> #include <gulicon.h> #include <aknbitmapanimation.h> diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 139139f..e6c36a4 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -413,7 +413,7 @@ struct QtFontFamily bool fixedPitchComputed : 1; #endif #ifdef Q_WS_X11 - bool symbol_checked; + bool symbol_checked : 1; #endif QString name; diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp index 5148568..0b38aab 100644 --- a/src/gui/text/qfontdatabase_s60.cpp +++ b/src/gui/text/qfontdatabase_s60.cpp @@ -162,6 +162,8 @@ void qt_cleanup_symbianFontDatabaseExtras() { const QSymbianFontDatabaseExtrasImplementation *dbExtras = static_cast<const QSymbianFontDatabaseExtrasImplementation*>(privateDb()->symbianExtras); + if (!dbExtras) + return; // initializeDb() has never been called #ifdef Q_SYMBIAN_HAS_FONTTABLE_API qDeleteAll(dbExtras->m_extrasHash); #else // Q_SYMBIAN_HAS_FONTTABLE_API diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 60195a8..439f2a4 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2668,9 +2668,9 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo flags |= QTextItem::StrikeOut; } -QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe) +QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars_, int numChars, QFontEngine *fe) : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), - num_chars(0), chars(0), logClusters(0), f(font), glyphs(g), fontEngine(fe) + num_chars(numChars), chars(chars_), logClusters(0), f(font), glyphs(g), fontEngine(fe) { } diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 908a0ec..e623fa5 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -311,7 +311,7 @@ public: logClusters(0), f(0), fontEngine(0) {} QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFormat &format = QTextCharFormat()); - QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe); + QTextItemInt(const QGlyphLayout &g, QFont *font, const QChar *chars, int numChars, QFontEngine *fe); /// copy the structure items, adjusting the glyphs arrays to the right subarrays. /// the width of the returned QTextItemInt is not adjusted, for speed reasons diff --git a/src/gui/widgets/qcommandlinkbutton.cpp b/src/gui/widgets/qcommandlinkbutton.cpp index e8fe299..d3b5869 100644 --- a/src/gui/widgets/qcommandlinkbutton.cpp +++ b/src/gui/widgets/qcommandlinkbutton.cpp @@ -118,7 +118,7 @@ public: int topMargin() const { return 10; } int leftMargin() const { return 7; } int rightMargin() const { return 4; } - int bottomMargin() const { return 4; } + int bottomMargin() const { return 10; } QString description; QColor currentColor; @@ -174,8 +174,15 @@ QFont QCommandLinkButtonPrivate::descriptionFont() const QRect QCommandLinkButtonPrivate::titleRect() const { Q_Q(const QCommandLinkButton); - return q->rect().adjusted(textOffset(), topMargin(), - -rightMargin(), 0); + QRect r = q->rect().adjusted(textOffset(), topMargin(), -rightMargin(), 0); + if (description.isEmpty()) + { + QFontMetrics fm(titleFont()); + r.setTop(r.top() + qMax(0, (q->icon().actualSize(q->iconSize()).height() + - fm.height()) / 2)); + } + + return r; } QRect QCommandLinkButtonPrivate::descriptionRect() const @@ -254,7 +261,7 @@ QSize QCommandLinkButton::minimumSizeHint() const Q_D(const QCommandLinkButton); QSize size = sizeHint(); int minimumHeight = qMax(d->descriptionOffset() + d->bottomMargin(), - iconSize().height() + d->topMargin()); + icon().actualSize(iconSize()).height() + d->topMargin()); size.setHeight(minimumHeight); return size; } @@ -328,7 +335,8 @@ int QCommandLinkButton::heightForWidth(int width) const int heightWithoutDescription = d->descriptionOffset() + d->bottomMargin(); // find the width available for the description area return qMax(heightWithoutDescription + d->descriptionHeight(width), - iconSize().height() + d->topMargin() + d->bottomMargin()); + icon().actualSize(iconSize()).height() + d->topMargin() + + d->bottomMargin()); } /*! \reimp */ diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index aa4ffce..e8e80b7 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -768,7 +768,7 @@ QAction *QMenuBarPrivate::getNextAction(const int _start, const int increment) c const int start = (_start == -1 && increment == -1) ? actions.count() : _start; const int end = increment == -1 ? 0 : actions.count() - 1; - for (int i = start; start != end;) { + for (int i = start; i != end;) { i += increment; QAction *current = actions.at(i); if (!actionRects.at(i).isNull() && (allowActiveAndDisabled || current->isEnabled())) |