[SOLVED]QML standard icons
-
Can you get the path of your images wanted? If yes, you can use path to set source of Image.
-
I'm trying to get the standard pixmaps from QStyle, and I don't believe those have an associated path for them. I did something like this and it works, but if there was an easier way I would like to do it.
@
QPixmap ZStandardImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{
if(mWidgetOfInterest.isNull())
return QPixmap(requestedSize);QIcon icon; if(id == DNTs("SP_MessageBoxWarning")) { icon = mWidgetOfInterest->style()->standardIcon(QStyle::SP_MessageBoxWarning); } if(icon.isNull()) return QPixmap(requestedSize); return icon.pixmap(requestedSize);
}
@ -
No I am afraid those icons are not directly exposed to qml so the suggested workaround is probably ok.
We do have support for iconNames on some controls though. I.e you can set iconName instead of iconSource to use bundled or system-specific themes, but that is not what you are looking for here.