Changeset 764


Ignore:
Timestamp:
Jul 29, 2010, 3:41:39 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: QCommonStyle::standardIconImplementation(): Generate the stanrad small and/or large icon size if it is missing from the stock icon (to avoid icon size differences in e.g. file dialogs).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/styles/qcommonstyle.cpp

    r651 r764  
    60096009                    QSize smallSz, largeSz;
    60106010                    foreach(const QSize &asz, sizes) {
    6011                         if (asz.width() < small)
     6011                        if (asz.width() < small && asz.width() > smallSz.width())
    60126012                            smallSz = asz;
    6013                         else if (asz.width() < large)
     6013                        else if (asz.width() < large && asz.width() > largeSz.width())
    60146014                            largeSz = asz;
    6015                         else
    6016                             break;
     6015                    }
     6016                    if (smallSz.isValid() && !largeSz.isValid()) {
     6017                        // add the large icon if missing by up-scaling the small one by 2
     6018                        QPixmap p = icon.pixmap(smallSz, mm, ss);
     6019                        largeSz = smallSz * 2;
     6020                        icon.addPixmap(p.scaled(largeSz, Qt::KeepAspectRatio,
     6021                                                Qt::SmoothTransformation));
     6022                    } else if (largeSz.isValid() && !smallSz.isValid()) {
     6023                        // add the small icon if missing by down-scaling the large one by 2
     6024                        QPixmap p = icon.pixmap(largeSz, mm, ss);
     6025                        largeSz = largeSz / 2;
     6026                        icon.addPixmap(p.scaled(smallSz, Qt::KeepAspectRatio,
     6027                                                Qt::SmoothTransformation));
    60176028                    }
    60186029                    if (smallSz.isValid()) {
Note: See TracChangeset for help on using the changeset viewer.