I am creating a ui app with Qt c++.
I have a error
message that I have created by using QMessageBox
Class like :
QMessageBox errorMessage;
errorMessage.critical(0, "Error", "An error has occured !");
errorMessage.setFixedSize(500, 200);
It is like:
And I want to change the red circled things which are the icon and the title.
I would appreciate any help.
Thanks in advance.
However you can use of QMessageBox::critical(0, "Error", "An error has occured !");
because critical(...)
method is static
and theres no need for create an instance of QMessageBox
.
Use bellow code
:
QMessageBox mb("Application Name",
"Hardware failure.\n\nDisk error detected\nDo you want to stop?",
QMessageBox::NoIcon,
QMessageBox::Yes | QMessageBox::Default,
QMessageBox::NoButton,
QMessageBox::NoButton);
QPixmap exportSuccess("/media/msi/Information/Pictures/Icons/Icons Pack/PNG/48X48/about.png");
mb.setIconPixmap(exportSuccess);
mb.exec();
This example work 100%
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With