diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-03 08:38:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-03 08:38:32 (GMT) |
commit | a8829a52d65a9759d5dffe98fb07b384c54db1c8 (patch) | |
tree | 59559409ffaa4f204685bdf1ab7e0721d79203b1 /src/gui | |
parent | a7189fb75a168f89db07d07eeb4f7fcd35d69942 (diff) | |
parent | ab9cb342554e89e0ff51afe3e8063d2719af16b1 (diff) | |
download | Qt-a8829a52d65a9759d5dffe98fb07b384c54db1c8.zip Qt-a8829a52d65a9759d5dffe98fb07b384c54db1c8.tar.gz Qt-a8829a52d65a9759d5dffe98fb07b384c54db1c8.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (30 commits)
Revert "Split Symbian bearer plugin into three platform specfic plugins"
Don't poll non-polling engines when configurations are in use.
Doc: updating images
Fix a corner case where a gesture sometimes doesn't start.
write PO files without duplicated message ids
my changes
Fix failing bypassShaping autotest on the Mac OS X
More Pixmap cache key optimizations
QNAM: Improve child deletion order
QSslCertificate: support large serial numbers
Split Symbian bearer plugin into three platform specfic plugins
Doc: adding offline docs to assistant and Qt Creator. Improving small docs and adding highlighting
Some optimizations for QImage::load()
fix setRawData()
Fix QML crashes on the N900
doc: Added DITA XML generator
Fix build failure on Symbian 3.1.
Add the Qt::TextBypassShaping flag.
QTextEngine: skip an unnecessary call to GetDeviceCaps on Windows.
Add my 4.7.0 changes
...
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qiconloader.cpp | 16 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qgesturemanager.cpp | 1 | ||||
-rw-r--r-- | src/gui/painting/qbrush.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qdrawutil.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_x11.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 25 | ||||
-rw-r--r-- | src/gui/styles/qgtkpainter.cpp | 51 | ||||
-rw-r--r-- | src/gui/styles/qgtkstyle.cpp | 2 | ||||
-rw-r--r-- | src/gui/styles/qplastiquestyle.cpp | 37 | ||||
-rw-r--r-- | src/gui/styles/qwindowsstyle.cpp | 5 | ||||
-rw-r--r-- | src/gui/text/qfontmetrics.cpp | 25 | ||||
-rw-r--r-- | src/gui/text/qfontmetrics.h | 1 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 8 | ||||
-rw-r--r-- | src/gui/text/qtextengine_p.h | 1 | ||||
-rw-r--r-- | src/gui/widgets/qstackedwidget.cpp | 8 |
16 files changed, 144 insertions, 66 deletions
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index a515ef8..34f40a9 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -63,6 +63,8 @@ #include <private/qt_x11_p.h> #endif +#include <private/qstylehelper_p.h> + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) @@ -488,14 +490,12 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st basePixmap.load(filename); int actualSize = qMin(size.width(), size.height()); - QString key = QLatin1String("$qt_theme_") - + QString::number(basePixmap.cacheKey(), 16) - + QLatin1Char('_') - + QString::number(mode) - + QLatin1Char('_') - + QString::number(qApp->palette().cacheKey(), 16) - + QLatin1Char('_') - + QString::number(actualSize); + + QString key = QLatin1Literal("$qt_theme_") + % HexString<qint64>(basePixmap.cacheKey()) + % HexString<int>(mode) + % HexString<qint64>(qApp->palette().cacheKey()) + % HexString<int>(actualSize); QPixmap cachedPixmap; if (QPixmapCache::find(key, &cachedPixmap)) { diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 3013726..20e4b50 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -82,6 +82,7 @@ #endif #include "qpixmap_raster_p.h" +#include "private/qstylehelper_p.h" QT_BEGIN_NAMESPACE @@ -829,8 +830,14 @@ bool QPixmap::load(const QString &fileName, const char *format, Qt::ImageConvers return false; QFileInfo info(fileName); - QString key = QLatin1String("qt_pixmap_") + info.absoluteFilePath() + QLatin1Char('_') + QString::number(info.lastModified().toTime_t()) + QLatin1Char('_') + - QString::number(info.size()) + QLatin1Char('_') + QString::number(data ? data->pixelType() : QPixmapData::PixmapType); + if (!info.exists()) + return false; + + QString key = QLatin1Literal("qt_pixmap") + % info.absoluteFilePath() + % HexString<uint>(info.lastModified().toTime_t()) + % HexString<quint64>(info.size()) + % HexString<uint>(data ? data->pixelType() : QPixmapData::PixmapType); if (QPixmapCache::find(key, *this)) return true; diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp index 43facef..a81d4e4 100644 --- a/src/gui/kernel/qgesturemanager.cpp +++ b/src/gui/kernel/qgesturemanager.cpp @@ -684,6 +684,7 @@ void QGestureManager::recycle(QGesture *gesture) if (recognizer) { gesture->setGestureCancelPolicy(QGesture::CancelNone); recognizer->reset(gesture); + m_activeGestures.remove(gesture); } else { cleanupGesturesForRemovedRecognizer(gesture); } diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index b468b11..d3061d8 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -48,6 +48,7 @@ #include "qline.h" #include "qdebug.h" #include <QtCore/qcoreapplication.h> +#include "private/qstylehelper_p.h" QT_BEGIN_NAMESPACE @@ -96,9 +97,11 @@ const uchar *qt_patternForBrush(int brushStyle, bool invert) QPixmap qt_pixmapForBrush(int brushStyle, bool invert) { + QPixmap pm; - QString key = QLatin1String("$qt-brush$") + QString::number(brushStyle) - + QString::number((int)invert); + QString key = QLatin1Literal("$qt-brush$") + % HexString<uint>(brushStyle) + % QLatin1Char(invert ? '1' : '0'); if (!QPixmapCache::find(key, pm)) { pm = QBitmap::fromData(QSize(8, 8), qt_patternForBrush(brushStyle, invert), QImage::Format_MonoLSB); diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index 3ce95ef..11ea6d5 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -48,6 +48,7 @@ #include <private/qpaintengineex_p.h> #include <qvarlengtharray.h> #include <qmath.h> +#include <private/qstylehelper_p.h> QT_BEGIN_NAMESPACE @@ -1018,7 +1019,9 @@ void qDrawItem(QPainter *p, Qt::GUIStyle gs, ; #ifndef QT_NO_IMAGE_HEURISTIC_MASK } else { // color pixmap, no mask - QString k = QString::fromLatin1("$qt-drawitem-%1").arg(pm.cacheKey()); + QString k = QLatin1Literal("$qt-drawitem") + % HexString<qint64>(pm.cacheKey()); + if (!QPixmapCache::find(k, pm)) { pm = pm.createHeuristicMask(); pm.setMask((QBitmap&)pm); diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index aef8b80..b8ad9b3 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -79,6 +79,8 @@ #include <private/qtessellator_p.h> #endif +#include <private/qstylehelper_p.h> + QT_BEGIN_NAMESPACE extern Drawable qt_x11Handle(const QPaintDevice *pd); @@ -224,7 +226,10 @@ static const uchar base_dither_matrix[DITHER_SIZE][DITHER_SIZE] = { static QPixmap qt_patternForAlpha(uchar alpha, int screen) { QPixmap pm; - QString key = QLatin1String("$qt-alpha-brush$") + QString::number(alpha) + QString::number(screen); + QString key = QLatin1Literal("$qt-alpha-brush$") + % HexString<uchar>(alpha) + % HexString<int>(screen); + if (!QPixmapCache::find(key, pm)) { // #### why not use a mono image here???? QImage pattern(DITHER_SIZE, DITHER_SIZE, QImage::Format_ARGB32); diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 4596754..97f754d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -72,6 +72,7 @@ #include <private/qmath_p.h> #include <qstatictext.h> #include <private/qstatictext_p.h> +#include <private/qstylehelper_p.h> QT_BEGIN_NAMESPACE @@ -5948,6 +5949,23 @@ void QPainter::drawText(const QPointF &p, const QString &str, int tf, int justif if (!d->engine || str.isEmpty() || pen().style() == Qt::NoPen) return; + if (tf & Qt::TextBypassShaping) { + // Skip harfbuzz complex shaping, shape using glyph advances only + int len = str.length(); + int numGlyphs = len; + QVarLengthGlyphLayoutArray glyphs(len); + QFontEngine *fontEngine = d->state->font.d->engineForScript(QUnicodeTables::Common); + if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) { + glyphs.resize(numGlyphs); + if (!fontEngine->stringToCMap(str.data(), len, &glyphs, &numGlyphs, 0)) + Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice"); + } + + QTextItemInt gf(glyphs, &d->state->font, fontEngine); + drawTextItem(p, gf); + return; + } + QStackTextEngine engine(str, d->state->font); engine.option.setTextDirection(d->state->layoutDirection); if (tf & (Qt::TextForceLeftToRight|Qt::TextForceRightToLeft)) { @@ -6228,10 +6246,9 @@ static QPixmap generateWavyPixmap(qreal maxRadius, const QPen &pen) { const qreal radiusBase = qMax(qreal(1), maxRadius); - QString key = QLatin1String("WaveUnderline-"); - key += pen.color().name(); - key += QLatin1Char('-'); - key += QString::number(radiusBase); + QString key = QLatin1Literal("WaveUnderline-") + % pen.color().name() + % HexString<qreal>(radiusBase); QPixmap pixmap; if (QPixmapCache::find(key, pixmap)) diff --git a/src/gui/styles/qgtkpainter.cpp b/src/gui/styles/qgtkpainter.cpp index 79c53e9..0217a39 100644 --- a/src/gui/styles/qgtkpainter.cpp +++ b/src/gui/styles/qgtkpainter.cpp @@ -241,8 +241,10 @@ void QGtkPainter::paintBoxGap(GtkWidget *gtkWidget, const gchar* part, if (rect.height() > maxHeight && (gap_side == GTK_POS_TOP || gap_side == GTK_POS_BOTTOM)) rect.setHeight(2 * border + 1); - QString gapExtras = QString(QLS("s %0 w %1 g %2")).arg(gap_side).arg(width).arg(x); - QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + gapExtras; + QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + % HexString<uchar>(gap_side) + % HexString<gint>(width) + % HexString<gint>(x); if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_box_gap (style, @@ -307,7 +309,7 @@ void QGtkPainter::paintBox(GtkWidget *gtkWidget, const gchar* part, rect.setHeight(2 * border + 1); QString pixmapName = uniqueName(QLS(part), state, shadow, - rect.size(), gtkWidget) + pmKey; + rect.size(), gtkWidget) % pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_box (style, @@ -357,9 +359,11 @@ void QGtkPainter::paintHline(GtkWidget *gtkWidget, const gchar* part, return; QPixmap cache; - QString hLineExtras = QString(QLS("%0 %1 %2")).arg(x1).arg(x2).arg(y); QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) - + hLineExtras + pmKey; + % HexString<int>(x1) + % HexString<int>(x2) + % HexString<int>(y) + % pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_hline (style, pixmap, @@ -384,9 +388,12 @@ void QGtkPainter::paintVline(GtkWidget *gtkWidget, const gchar* part, return; QPixmap cache; - QString vLineExtras = QString(QLS("%0 %1 %2")).arg(y1).arg(y2).arg(x); - QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), - gtkWidget) + vLineExtras +pmKey; + QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + % HexString<int>(y1) + % HexString<int>(y2) + % HexString<int>(x) + % pmKey; + if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_vline (style, pixmap, @@ -412,8 +419,10 @@ void QGtkPainter::paintExpander(GtkWidget *gtkWidget, return; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), - gtkWidget) + QString::number(expander_state) + pmKey; + QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + % HexString<uchar>(expander_state) + % pmKey; + if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_expander (style, pixmap, state, NULL, @@ -436,7 +445,7 @@ void QGtkPainter::paintFocus(GtkWidget *gtkWidget, const gchar* part, return; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + pmKey; + QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) % pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_focus (style, pixmap, state, NULL, gtkWidget, @@ -461,7 +470,7 @@ void QGtkPainter::paintResizeGrip(GtkWidget *gtkWidget, const gchar* part, return; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey; + QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_resize_grip (style, pixmap, state, NULL, gtkWidget, @@ -486,8 +495,9 @@ void QGtkPainter::paintArrow(GtkWidget *gtkWidget, const gchar* part, return; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + - QString::number((int)arrow_type) + pmKey; + QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + % HexString<uchar>(arrow_type) + % pmKey; GdkRectangle gtkCliprect = {0, 0, rect.width(), rect.height()}; int xOffset = m_cliprect.isValid() ? arrowrect.x() - m_cliprect.x() : 0; @@ -518,7 +528,8 @@ void QGtkPainter::paintHandle(GtkWidget *gtkWidget, const gchar* part, const QRe QPixmap cache; QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) - + QString::number(orientation); + % HexString<uchar>(orientation); + if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_handle (style, pixmap, @@ -546,7 +557,7 @@ void QGtkPainter::paintSlider(GtkWidget *gtkWidget, const gchar* part, const QRe return; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey; + QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) % pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_slider (style, pixmap, @@ -577,7 +588,7 @@ void QGtkPainter::paintShadow(GtkWidget *gtkWidget, const gchar* part, QRect r = rect; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey; + QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_shadow(style, pixmap, state, shadow, NULL, gtkWidget, part, 0, 0, rect.width(), rect.height())); @@ -596,7 +607,7 @@ void QGtkPainter::paintFlatBox(GtkWidget *gtkWidget, const gchar* part, return; QRect r = rect; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey; + QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) % pmKey; if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_flat_box (style, pixmap, @@ -623,8 +634,8 @@ void QGtkPainter::paintExtention(GtkWidget *gtkWidget, QRect r = rect; QPixmap cache; - QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget); - pixmapName += QString::number(gap_pos); + QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + % HexString<uchar>(gap_pos); if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) { DRAW_TO_CACHE(QGtkStylePrivate::gtk_paint_extension (style, pixmap, state, shadow, diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 9d6dc9a..5465c7b 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -692,7 +692,7 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element, // thin rectangular images const int pmSize = 64; const int border = proxy()->pixelMetric(PM_DefaultFrameWidth, option, widget); - const QString pmKey = QString(QLS("windowframe %0")).arg(option->state); + const QString pmKey = QLatin1Literal("windowframe") % HexString<uint>(option->state); QPixmap pixmap; QRect pmRect(QPoint(0,0), QSize(pmSize, pmSize)); diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index c8711f6..20d9bd9 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -488,7 +488,9 @@ static void qBrushSetAlphaF(QBrush *brush, qreal alpha) // Modify the texture - ridiculously expensive. QPixmap texture = brush->texture(); QPixmap pixmap; - QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey()); + QString name = QLatin1Literal("qbrushtexture-alpha") + % HexString<qreal>(alpha) + % HexString<qint64>(texture.cacheKey()); if (!QPixmapCache::find(name, pixmap)) { QImage image = texture.toImage(); QRgb *rgb = reinterpret_cast<QRgb *>(image.bits()); @@ -549,7 +551,10 @@ static QBrush qBrushLight(QBrush brush, int light) // Modify the texture - ridiculously expensive. QPixmap texture = brush.texture(); QPixmap pixmap; - QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey()); + QString name = QLatin1Literal("qbrushtexture-light") + % HexString<int>(light) + % HexString<qint64>(texture.cacheKey()); + if (!QPixmapCache::find(name, pixmap)) { QImage image = texture.toImage(); QRgb *rgb = reinterpret_cast<QRgb *>(image.bits()); @@ -608,7 +613,10 @@ static QBrush qBrushDark(QBrush brush, int dark) // Modify the texture - ridiculously expensive. QPixmap texture = brush.texture(); QPixmap pixmap; - QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey()); + QString name = QLatin1Literal("qbrushtexture-dark") + % HexString<int>(dark) + % HexString<qint64>(texture.cacheKey()); + if (!QPixmapCache::find(name, pixmap)) { QImage image = texture.toImage(); QRgb *rgb = reinterpret_cast<QRgb *>(image.bits()); @@ -732,8 +740,12 @@ static QColor mergedColors(const QColor &colorA, const QColor &colorB, int facto static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop) { - QString gradientName; - gradientName.sprintf("%dx%d-%x-%x", rect.width(), rect.height(), gradientStart.rgba(), gradientStop.rgba()); + QString gradientName = QLatin1Literal("qplastique-g") + % HexString<int>(rect.width()) + % HexString<int>(rect.height()) + % HexString<QRgb>(gradientStart.rgba()) + % HexString<QRgb>(gradientStop.rgba()); + QPixmap cache; QPainter *p = painter; QRect r = rect; @@ -1092,14 +1104,6 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption Q_ASSERT(option); QColor borderColor = option->palette.background().color().darker(178); - QColor gradientStartColor = option->palette.button().color().lighter(104); - QColor gradientStopColor = option->palette.button().color().darker(105); - QColor highlightedGradientStartColor = option->palette.button().color().lighter(101); - QColor highlightedGradientStopColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 85); - QColor highlightedBaseGradientStartColor = option->palette.base().color(); - QColor highlightedBaseGradientStopColor = mergedColors(option->palette.base().color().darker(105), option->palette.highlight().color(), 70); - QColor highlightedDarkInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 35); - QColor highlightedLightInnerBorderColor = mergedColors(option->palette.button().color(), option->palette.highlight().color(), 58); QColor alphaCornerColor; if (widget) { // ### backgroundrole/foregroundrole should be part of the style option @@ -1107,13 +1111,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption } else { alphaCornerColor = mergedColors(option->palette.background().color(), borderColor); } - QColor alphaInnerColor = mergedColors(highlightedLightInnerBorderColor, gradientStartColor); - QColor alphaInnerColorNoHover = mergedColors(borderColor, gradientStartColor); QColor alphaTextColor = mergedColors(option->palette.background().color(), option->palette.text().color()); - QColor alphaLightTextColor = mergedColors(option->palette.background().color().lighter(250), option->palette.text().color().lighter(250)); - QColor lightShadow = option->palette.button().color().lighter(105); - QColor shadowGradientStartColor = option->palette.button().color().darker(115); - QColor shadow = shadowGradientStartColor; switch (element) { case PE_IndicatorButtonDropDown: @@ -2057,7 +2055,6 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op bool reverse = (tab->direction == Qt::RightToLeft); int lowerTop = selected ? 0 : 3; // to make the selected tab bigger than the rest - QRect adjustedRect; bool atEnd = (tab->position == QStyleOptionTab::End) || onlyTab; bool atBeginning = ((tab->position == QStyleOptionTab::Beginning) || onlyTab) && !leftCornerWidget; diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp index 0314c6f..579dd0b 100644 --- a/src/gui/styles/qwindowsstyle.cpp +++ b/src/gui/styles/qwindowsstyle.cpp @@ -1388,8 +1388,9 @@ void QWindowsStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QRect r = opt->rect; int size = qMin(r.height(), r.width()); QPixmap pixmap; - QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") + QLatin1String(metaObject()->className()), opt, QSize(size, size)) - + QLatin1Char('-') + QString::number(pe); + QString pixmapName = QStyleHelper::uniqueName(QLatin1String("$qt_ia-") + % QLatin1String(metaObject()->className()), opt, QSize(size, size)) + % HexString<uint>(pe); if (!QPixmapCache::find(pixmapName, pixmap)) { int border = size/5; int sqsize = 2*(size/2); diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 5163c94..d02e841 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -526,6 +526,14 @@ int QFontMetrics::rightBearing(QChar ch) const */ int QFontMetrics::width(const QString &text, int len) const { + return width(text, len, 0); +} + +/*! + \internal +*/ +int QFontMetrics::width(const QString &text, int len, int flags) const +{ int pos = text.indexOf(QLatin1Char('\x9c')); if (pos != -1) { len = (len < 0) ? pos : qMin(pos, len); @@ -535,6 +543,23 @@ int QFontMetrics::width(const QString &text, int len) const if (len == 0) return 0; + if (flags & Qt::TextBypassShaping) { + // Skip harfbuzz complex shaping, only use advances + int numGlyphs = len; + QVarLengthGlyphLayoutArray glyphs(numGlyphs); + QFontEngine *engine = d->engineForScript(QUnicodeTables::Common); + if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, 0)) { + glyphs.resize(numGlyphs); + if (!engine->stringToCMap(text.data(), len, &glyphs, &numGlyphs, 0)) + Q_ASSERT_X(false, Q_FUNC_INFO, "stringToCMap shouldn't fail twice"); + } + + QFixed width; + for (int i = 0; i < numGlyphs; ++i) + width += glyphs.advances_x[i]; + return qRound(width); + } + QStackTextEngine layout(text, d.data()); layout.ignoreBidi = true; return qRound(layout.width(0, len)); diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index dca4b93..2518b54 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -89,6 +89,7 @@ public: int leftBearing(QChar) const; int rightBearing(QChar) const; int width(const QString &, int len = -1) const; + int width(const QString &, int len, int flags) const; int width(QChar) const; int charWidth(const QString &str, int pos) const; diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index d34553f..3486264 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -885,7 +885,7 @@ void QTextEngine::shapeText(int item) const QFixed letterSpacing = font.d->letterSpacing; QFixed wordSpacing = font.d->wordSpacing; - if (letterSpacingIsAbsolute) + if (letterSpacingIsAbsolute && letterSpacing.value()) letterSpacing *= font.d->dpi / qt_defaultDpiY(); if (letterSpacing != 0) { @@ -2648,6 +2648,12 @@ QTextItemInt::QTextItemInt(const QScriptItem &si, QFont *font, const QTextCharFo flags |= QTextItem::StrikeOut; } +QTextItemInt::QTextItemInt(const QGlyphLayout &g, QFont *font, QFontEngine *fe) + : flags(0), justified(false), underlineStyle(QTextCharFormat::NoUnderline), + num_chars(0), chars(0), logClusters(0), f(font), fontEngine(fe), glyphs(g) +{ +} + QTextItemInt QTextItemInt::midItem(QFontEngine *fontEngine, int firstGlyphIndex, int numGlyphs) const { QTextItemInt ti = *this; diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index d92148f..00b1392 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -311,6 +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); /// 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/qstackedwidget.cpp b/src/gui/widgets/qstackedwidget.cpp index 2509a21..de8d3e6 100644 --- a/src/gui/widgets/qstackedwidget.cpp +++ b/src/gui/widgets/qstackedwidget.cpp @@ -186,11 +186,11 @@ int QStackedWidget::insertWidget(int index, QWidget *widget) } /*! - Removes the given \a widget from the QStackedWidget. + Removes \a widget from the QStackedWidget. i.e., \a widget is \e + not deleted but simply removed from the stacked layout, causing it + to be hidden. - \bold{Note:} The ownership of \a widget remains the same. - The widget is \e not deleted, but simply removed from the widget's - stacked layout, causing it to be hidden. + \bold{Note:} Ownership of \a widget reverts to the application. \sa addWidget(), insertWidget(), currentWidget() */ |