Results 1 to 3 of 3

Thread: Opening a browser in MAC

  1. #1
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    4
    Qt products
    Qt3 Qt4

    Default Opening a browser in MAC

    I use 'ShellExecute' on windows to launch the browser with my URL string.

    Does QT have options for which I can do the same on a MAC?
    Any pointers will be useful.
    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Opening a browser in MAC

    Hi, have you seen QDesktopServices::openUrl()?

  3. The following user says thank you to Lykurg for this useful post:

    gren15 (30th June 2009)

  4. #3
    Join Date
    Feb 2009
    Posts
    22
    Thanks
    4
    Qt products
    Qt3 Qt4

    Default Re: Opening a browser in MAC

    Thanks Lykurg!!!

    This was exactly what I wanted. It is so good to see that QT now (rather from 4.2) has this function, it eases the whole process of launching the browser.

    Out of curiosity, does it take care of the issue on Vista machines where depending on the user privileges a file attempted to opened has to get the 'consent prompt'

    Qt Code:
    1. //****************************************
    2. // On Windows XP
    3. //****************************************
    4.  
    5. ShellExecute(
    6. NULL,
    7. "open",
    8. sCompletePath,
    9. NULL,
    10. NULL,
    11. SW_SHOWNORMAL );
    12.  
    13.  
    14. //****************************************
    15. // On Windows Vista
    16. //****************************************
    17.  
    18. ShellExecute(
    19. NULL,
    20. "runas",//<------------------ on Vista machines
    21. sCompletePath,
    22. NULL, // params
    23. NULL, // directory
    24. SW_SHOWNORMAL);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 3
    Last Post: 28th May 2008, 23:45
  2. Replies: 7
    Last Post: 14th March 2008, 13:52
  3. Invoking a browser...???
    By deepusrp in forum Newbie
    Replies: 4
    Last Post: 12th June 2007, 17:32
  4. How a server can write "Hello" to a browser ?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 1st December 2006, 14:43
  5. Opening swf file in the default browser
    By munna in forum Qt Programming
    Replies: 16
    Last Post: 5th May 2006, 09:33

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.