QStyle* style = QApplication::style(); QPixmap pixmap = style->standardPixmap(QStyle::SP_FileOpen);
QStyle* style = QApplication::style(); QIcon icon = style->standardIcon(QStyle::SP_MessageBoxCritical);This example retrieves the standard "Critical Message Box" icon and stores it in a QIcon object. The QIcon can then be used to display the icon in a QMessageBox or other relevant widget. These examples both use the QApplication::style() function to retrieve an instance of the current GUI style. They then call the standardPixmap() or standardIcon() function, passing in the desired icon identifier from the QStyle::StandardPixmap or QStyle::StandardPixmap enumeration. The QStyle library is a standard part of Qt, and is included in the QtCore and QtGui packages.