Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An "About" message box for a GUI with Qt

    QMessageBox::about( this, "About Application",
    "<h4>Application is a one-paragraph blurb</h4>\n\n"
"Copyright 1991-2003 Such-and-such. "
"For technical support, call 1234-56789 or see\n"
"<a href=\"http://www.such-and-such.com\">http://www.such-and-such.com</a>" );

This code is creating the About message box which I wanted to have with two exceptions:

1) I would like to change the icon in the message box with an aaa.png file

2) And I would like to have the link clickable. It looks like hyperlink (it is blue and underlined) but mouse click does not work

Any ideas?

like image 713
Narek Avatar asked Mar 17 '10 18:03

Narek


2 Answers

I think you should create a custom QWidget for your about widget. By this way, you can put on the widget all you want. By example, you can place QLabel using the openExternalLinks property for clickable link.

To display a custom image on the QWidget, this example may help.

like image 152
Patrice Bernassola Avatar answered Oct 17 '22 12:10

Patrice Bernassola


For the icon, you need to just set the application icon. Something like this:

QApplication::setWindowIcon(QIcon(":/aaa.png")); // from a resource file

As for making the links clickable, I don't think it can be done with the QMessageBox::about API directly.

like image 36
Evan Teran Avatar answered Oct 17 '22 11:10

Evan Teran