[PyQt] Menu Item Opening Web Page?

Andreas Pakulat apaku at gmx.de
Wed Jul 29 18:51:40 BST 2009


On 29.07.09 10:26:28, Brent Villalobos wrote:
> Is there a way to create a QAction object (aka, what is created when
> you add an item to a menu bar in Designer) that links to a web page?
> For example, I want to create a "User Documentation" menu option
> that will just open up a specific web page using the default
> browser.  Qt must have some sort of smarts for this because if I
> create a hyperlink in a text field it will do just that.  I'm just
> trying to figure out how to do that with menu options.  Any
> thoughts?

Look into QDesktopService, it'll allow you to open a url. So once you
have that all you need is a slot for the QAction that calls the openUrl
function with the right url.

Andreas

-- 
Good day to let down old friends who need help.


More information about the PyQt mailing list