Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt - set url link for an image
Qt 6.11 is out! See what's new in the release blog

Qt - set url link for an image

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    MohammadReza
    wrote on last edited by
    #1

    Hello friends,

    I want to put a picture in my form that have a URL link.
    For example, a g+ icon that link to my profile.
    Note: The web browser must be open.

    Thanks a lot.
    Ya Ali.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      Do the following on click of your image:

      @
      #include <QDesktopServices>
      #include <QUrl>

      void MyWidget::imageClicked()
      {
      QDesktopServices::openUrl(QUrl("http://www.whatever.com"));
      }
      @

      That will use the system default URL handler to open the url. So basically whatever browser the user has set.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved