Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[SOLVED] How can I link to a website when an action is triggered



  • How can I link to a website when an action is triggered?

    I know how to open external HTML pages making a label clickable but what I want is to have a link in the main drop down menu (File Edit View etc) that when triggered it points to an external website, basically an action pointing to an HTML help-page.

    What would be the best way to do this?

    Clickable label
    @ui->label->setOpenExternalLinks(true);
    ui->label->setText("<a >My Site</a>");@

    Thanks


  • Moderators

    connect your action to a slot like this:
    @
    void MySlot()
    {
    QDesktopServices::openUrl( QUrl("http://www.website.com") );
    }
    @



  • Cool, thanks a lot.


Log in to reply