Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/image/qicon.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    6767#endif
    6868
     69#include "private/qstylehelper_p.h"
     70
    6971#ifndef QT_NO_ICON
    7072QT_BEGIN_NAMESPACE
     
    262264        actualSize.scale(size, Qt::KeepAspectRatio);
    263265
    264     QString key = QLatin1String("$qt_icon_")
    265                   + QString::number(pm.cacheKey())
    266                   + QString::number(pe->mode)
    267                   + QString::number(QApplication::palette().cacheKey())
    268                   + QLatin1Char('_')
    269                   + QString::number(actualSize.width())
    270                   + QLatin1Char('_')
    271                   + QString::number(actualSize.height())
    272                   + QLatin1Char('_');
    273 
     266    QString key = QLatin1Literal("qt_")
     267                  % HexString<quint64>(pm.cacheKey())
     268                  % HexString<uint>(pe->mode)
     269                  % HexString<quint64>(QApplication::palette().cacheKey())
     270                  % HexString<uint>(actualSize.width())
     271                  % HexString<uint>(actualSize.height());
    274272
    275273    if (mode == QIcon::Active) {
    276         if (QPixmapCache::find(key + QString::number(mode), pm))
     274        if (QPixmapCache::find(key % HexString<uint>(mode), pm))
    277275            return pm; // horray
    278         if (QPixmapCache::find(key + QString::number(QIcon::Normal), pm)) {
     276        if (QPixmapCache::find(key % HexString<uint>(QIcon::Normal), pm)) {
    279277            QStyleOption opt(0);
    280278            opt.palette = QApplication::palette();
     
    285283    }
    286284
    287     if (!QPixmapCache::find(key + QString::number(mode), pm)) {
     285    if (!QPixmapCache::find(key % HexString<uint>(mode), pm)) {
    288286        if (pm.size() != actualSize)
    289287            pm = pm.scaled(actualSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
     
    295293                pm = generated;
    296294        }
    297         QPixmapCache::insert(key + QString::number(mode), pm);
     295        QPixmapCache::insert(key % HexString<uint>(mode), pm);
    298296    }
    299297    return pm;
     
    442440}
    443441
    444 #if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
     442#ifndef QT_NO_LIBRARY
    445443Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
    446444    (QIconEngineFactoryInterface_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive))
     
    880878
    881879/*!
     880    \since 4.7
     881
     882    Returns the name used to create the icon, if available.
     883
     884    Depending on the way the icon was created, it may have an associated
     885    name. This is the case for icons created with fromTheme() or icons
     886    using a QIconEngine which supports the QIconEngineV2::IconNameHook.
     887
     888    \sa fromTheme(), QIconEngine
     889*/
     890QString QIcon::name() const
     891{
     892    if (!d || !d->engine || d->engine_version < 2)
     893        return QString();
     894    QIconEngineV2 *engine = static_cast<QIconEngineV2*>(d->engine);
     895    return engine->iconName();
     896}
     897
     898/*!
    882899    \since 4.6
    883900
Note: See TracChangeset for help on using the changeset viewer.