diff --git a/examples/widgets/itemviews/dirview/dirview.pro b/examples/widgets/itemviews/dirview/dirview.pro
index 981a64a7d6..7b87f30a71 100644
--- a/examples/widgets/itemviews/dirview/dirview.pro
+++ b/examples/widgets/itemviews/dirview/dirview.pro
@@ -1,6 +1,6 @@
 QT += widgets
 requires(qtConfig(treeview))
-
+CONFIG+=console
 SOURCES       = main.cpp
 
 # install
diff --git a/examples/widgets/itemviews/dirview/main.cpp b/examples/widgets/itemviews/dirview/main.cpp
index 20e5d45c95..3719b1ae1e 100644
--- a/examples/widgets/itemviews/dirview/main.cpp
+++ b/examples/widgets/itemviews/dirview/main.cpp
@@ -52,11 +52,41 @@
 #include <QFileSystemModel>
 #include <QFileIconProvider>
 #include <QScreen>
+#include <QMenu>
+#include <QLabel>
+#include <QAction>
 #include <QScroller>
 #include <QTreeView>
+#include <QFileIconProvider>
 #include <QCommandLineParser>
 #include <QCommandLineOption>
 
+QTreeView *tv ;
+
+static void customContextMenuRequested(const QPoint &pos)
+{
+    auto idx = tv->indexAt(pos);
+    if (!idx.isValid())
+        return;
+    auto fs = static_cast<QFileSystemModel *>(tv->model());
+
+    auto fi = fs->fileInfo(idx);
+    qDebug() << fi.absoluteFilePath();
+
+    QMenu m;
+    auto sa = m.addAction("Show");
+    if (m.exec(tv->mapToGlobal(pos)) == sa) {
+        auto ic = fs->data(idx.sibling(idx.row(), 0), Qt::DecorationRole).value<QIcon>();
+        qDebug() << __FUNCTION__ << ic;
+        if (!ic.availableSizes().isEmpty()) {
+            auto px = ic.pixmap(ic.availableSizes().back());
+            auto l = new QLabel;
+            l->setPixmap(px);
+            l->show();
+        }
+    }
+}
+
 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
@@ -76,12 +106,17 @@ int main(int argc, char *argv[])
         ? QString() : parser.positionalArguments().first();
 
     QFileSystemModel model;
+    QFileIconProvider p;
+    model.setIconProvider(&p);
     model.setRootPath("");
     if (parser.isSet(dontUseCustomDirectoryIconsOption))
         model.setOption(QFileSystemModel::DontUseCustomDirectoryIcons);
     if (parser.isSet(dontWatchOption))
         model.setOption(QFileSystemModel::DontWatchForChanges);
     QTreeView tree;
+    tv = &tree;
+    tree.setContextMenuPolicy(Qt::CustomContextMenu);
+    QObject::connect(&tree, &QWidget::customContextMenuRequested, customContextMenuRequested);
     tree.setModel(&model);
     if (!rootPath.isEmpty()) {
         const QModelIndex rootIndex = model.index(QDir::cleanPath(rootPath));
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 4f31414e10..aeb9877918 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -175,6 +175,7 @@ void QPixmapIconEngine::paint(QPainter *painter, const QRect &rect, QIcon::Mode
     qreal dpr = paintDevice ? paintDevice->devicePixelRatio() : qApp->devicePixelRatio();
     const QSize pixmapSize = rect.size() * dpr;
     QPixmap px = scaledPixmap(pixmapSize, mode, state, dpr);
+    qDebug() << __FUNCTION__ << px << rect << mode << state;
     painter->drawPixmap(rect, px);
 }
 
@@ -296,29 +297,37 @@ QPixmap QPixmapIconEngine::pixmap(const QSize &size, QIcon::Mode mode, QIcon::St
 
 QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale)
 {
-
     QPixmap pm;
     QPixmapIconEngineEntry *pe = bestMatch(size, scale, mode, state, false);
+    qDebug() << __FUNCTION__ << size << pixmaps.size() << "pe" << pe;
     if (pe)
         pm = pe->pixmap;
 
     if (pm.isNull()) {
         int idx = pixmaps.count();
         while (--idx >= 0) {
+            qDebug() << __FUNCTION__ << "loop" << idx;
             if (pe == &pixmaps.at(idx)) {
                 pixmaps.remove(idx);
                 break;
             }
         }
-        if (pixmaps.isEmpty())
+
+        if (pixmaps.isEmpty()) {
+            qDebug() << __FUNCTION__ << "r1" << pm;
             return pm;
-        else
-            return pixmap(size, mode, state);
+        } else {
+            auto r = pixmap(size, mode, state);
+            qDebug() << __FUNCTION__ << "r2" << r;
+            return r;
+        }
     }
 
+
     QSize actualSize = pm.size();
     if (!actualSize.isNull() && (actualSize.width() > size.width() || actualSize.height() > size.height()))
         actualSize.scale(size, Qt::KeepAspectRatio);
+    qDebug() << __FUNCTION__ << actualSize;
 
     QString key = QLatin1String("qt_")
                   % HexString<quint64>(pm.cacheKey())
@@ -351,6 +360,7 @@ QPixmap QPixmapIconEngine::scaledPixmap(const QSize &size, QIcon::Mode mode, QIc
         }
         QPixmapCache::insert(key % HexString<uint>(mode), pm);
     }
+    qDebug() << __FUNCTION__ << "rf" << pm;
     return pm;
 }
 
diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp
index 0c778ecd24..020766f771 100644
--- a/src/plugins/platforms/windows/qwindowstheme.cpp
+++ b/src/plugins/platforms/windows/qwindowstheme.cpp
@@ -916,8 +916,14 @@ QString QWindowsFileIconEngine::cacheKey() const
         + (suffix.isEmpty() ? fileInfo().fileName() : std::move(suffix).toUpper()); // handle "Makefile"                                    ;)
 }
 
-QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode, QIcon::State)
+QPixmap QWindowsFileIconEngine::filePixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
 {
+    /*
+    QPixmap p(size);
+    p.fill(Qt::yellow);
+    return p;
+    */
+
     /* We don't use the variable, but by storing it statically, we
      * ensure CoInitialize is only called once. */
     static HRESULT comInit = CoInitialize(nullptr);
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index 2b8ee4f29c..a458a6f4d4 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -3743,6 +3743,7 @@ void QAbstractItemView::initViewItemOption(QStyleOptionViewItem *option) const
         int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
         option->decorationSize = QSize(pm, pm);
     }
+    qDebug() << __FUNCTION__ << option->decorationSize;
     option->decorationPosition = QStyleOptionViewItem::Left;
     option->decorationAlignment = Qt::AlignCenter;
     option->displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 97bf8ac939..8c859359b3 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -315,6 +315,8 @@ void QStyledItemDelegate::initStyleOption(QStyleOptionViewItem *option,
     }
 
     value = modelRoleDataSpan.dataForRole(Qt::DecorationRole);
+    if (index.column() == 0)
+        qDebug() << __FUNCTION__ << value << (value->isValid() && !value->isNull());
     if (value->isValid() && !value->isNull()) {
         option->features |= QStyleOptionViewItem::HasDecoration;
         switch (value->userType()) {
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 3e4e7ea6fe..9ba45edf97 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -2283,6 +2283,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
 
             QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
             QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget);
+            if (vopt->features & QStyleOptionViewItem::HasDecoration)
+                qDebug() << __FUNCTION__ << "icr" << iconRect
+                       << vopt->icon << vopt->text;
             QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget);
 
             // draw the background
@@ -2315,7 +2318,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
             else if (vopt->state & QStyle::State_Selected)
                 mode = QIcon::Selected;
             QIcon::State state = vopt->state & QStyle::State_Open ? QIcon::On : QIcon::Off;
-            vopt->icon.paint(p, iconRect, vopt->decorationAlignment, mode, state);
+            vopt->icon.paint(p, iconRect, vopt->decorationAlignment, mode, state);            
 
             // draw the text
             if (!vopt->text.isEmpty()) {
