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. Should we check if for example QDesktopServices returns false?
Qt 6.11 is out! See what's new in the release blog

Should we check if for example QDesktopServices returns false?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 753 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.
  • L Offline
    L Offline
    Leon
    wrote on last edited by
    #1

    bq. Opens the given url in the appropriate Web browser for the user's desktop environment, and returns true if successful; otherwise returns false.

    So should i create a bool function
    @void Global::openUrl(const QString &url){
    if(!QDesktopServices::openUrl(QUrl(url))){
    Global::error("I probably could not open ""+url+""");
    }
    }@

    and call
    @Global::openUrl("http://melloristudio.com/wallch/1000-HD-Wallpapers");@
    everytime, or simply
    @QDesktopServices::openUrl(QUrl("http://melloristudio.com/wallch/1000-HD-Wallpapers"));@

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Checking for failures is always handy. Especially when you log messages your application puts out: then it will be easier for you to triage bug reports based on a log file.

      (Z(:^

      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