I think your problem might be here:
QPixmap(appIcon.pixmap(2,QIcon::Normal,QIcon::On))
To copy to clipboard, switch view to plain text mode
First of all QIcon::pixmap() already returns QPixmap so invoking QPixmap constructor again is not necessary (but it is not an error). The strange thing in your code is that "2"... it means that you want and pixmap of size 2x2... not so big for me. Try changing it to 32 for example and check if it helps.
For me this works fine:
tr("Choose file..."),
qApp->applicationDirPath());
scene
->addPixmap
(icon.
pixmap(32,
QIcon::Normal,
QIcon::On))->setPos
(50,
50);
QString filename = QFileDialog::getOpenFileName(this,
tr("Choose file..."),
qApp->applicationDirPath());
QFileIconProvider fip;
QIcon icon = fip.icon(QFileInfo(filename));
scene->addPixmap(icon.pixmap(32, QIcon::Normal, QIcon::On))->setPos(50, 50);
To copy to clipboard, switch view to plain text mode
Bookmarks