Clickable URL in About message box



  • Hi folks,
    In my application I have an About box. The code looks a bit like this.

    @
    QMessageBox::about(this, tr("About MyApp"),
    tr("Visit my www.website.com"));
    @

    I'd like the link to my website to be clickable so people can visit it.
    Is that possible? If I just put the <a > tag around it it is just a link but not clickable.

    Or: would be possible to create a menu item that says: "Visit webite" and when clicked the default browser is started and the website URL specified is loaded?

    Thanks!

    Sjaacko

    [EDIT: code formatting, please wrap in @-tags, Volker]



  • Hi,

    Yes it is possible. There are different ways to implement it as a GUI. You can create a custom widget with QPushButton or QMessageBox with a OK button or something else.

    No matter which way you choose you can start the default web browser and load the url using QDesktopServices and QUrl. Check "this simple code snippet":http://developer.qt.nokia.com/wiki/How_to_Launch_Web_Browser for more info.

    Cheers,
    Leon



  • Thank you for this quick answer. I implemented in my application and it works just fine! Exactly the way I want it :-) Thanks so much!



  • Great :) I am glad that the provided link has helped you to solve the issue.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.