QMessageBox warning yellow exclamation mark icon

linello picture linello · Jun 26, 2012 · Viewed 15.9k times · Source

How is possible to display a QMessageBox::warning with the triangular exclamation mark symbol like the one following?

Yellow background triangular exclamation mark

I can't find any option in QMessageBox::warning, I only get the red circular symbol.

Answer

Gianluca picture Gianluca · Jun 26, 2012

The triangular icon should be the default for the QMessageBox::warning dialog, while the red circular one is the default for the QMessageBox::critical dialog.

In my python code I use either

QMessageBox.warning(None,QString("..."),QString("...."))

or the more complex

msg = "..."
q = QMessageBox(QMessageBox.Warning, "...",  QString(msg))
q.setStandardButtons(QMessageBox.Ok);
i = QIcon()
i.addPixmap(QPixmap("..."), QIcon.Normal)
q.setWindowIcon(i)
q.exec_()

And both of them works well.

Eventually can you show the code you use to show the dialog ?