Results 1 to 7 of 7

Thread: Clickable weblink

  1. #1
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Clickable weblink

    In my app I have an About.. dialog where I want to put some info plus a couple of web addresses. The web addresses should be clickable so that the standard browser (Explorer, Firefox, Safari) will open the page.

    I will not be surprised if this is a very simple thing to set up, but I have not yet found it.
    Any clue will be appreciated.

    BN
    MacOSX user dabbling with Linux and Windows.

  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: Clickable weblink

    Please note our Newbie section, if you already know that that is an easy question!

    QLabel, QLabel::openExternalLinks, Qt::TextInteractionFlags

  3. #3
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Clickable weblink

    Thank you very much!
    MacOSX user dabbling with Linux and Windows.

  4. #4
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Clickable weblink

    Well, apparently it was not so simple.

    Qt Code:
    1. QLabel *www1_label;
    2. ..
    3. www1_label->setText(Weblink1);
    4. www1_label->setTextInteractionFlags ( Qt::LinksAccessibleByMouse );
    5. www1_label->setOpenExternalLinks(true);
    To copy to clipboard, switch view to plain text mode 

    does nothing. The link is not active and nothing happens when clicking on it.
    There is no change of cursor when the pointer is pasing over it.
    What have I missed?
    Is there any example I can look at?
    MacOSX user dabbling with Linux and Windows.

  5. #5
    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: Clickable weblink

    Quote Originally Posted by bnilsson View Post
    Well, apparently it was not so simple.
    Sure it is. What's the content of Weblink1? I guess you don't use the a tag.
    Qt Code:
    1. www1_label->setText("<a href=\"http://www.qtcentre.org\">www.qtcentre.org</a>");
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Clickable weblink

    What is the weblink ?
    I tried simply in designer and it works smooth for me.

    Also try this -
    Qt Code:
    1. www1_label->setTextInteractionFlags(www1_label->textInteractionFlags() | Qt::LinksAccessibleByMouse );
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Jan 2008
    Posts
    155
    Thanks
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Clickable weblink

    Ok, thanks.
    Did you say this tag stuff was documented somewhere in this context?


    Sorry that my mind went blank, missing the obvious fact that I had use html syntax.
    I will post more on the Newbie forum from here after.
    Last edited by bnilsson; 23rd June 2009 at 19:36.
    MacOSX user dabbling with Linux and Windows.

Similar Threads

  1. Clickable URL in QMessageBox?
    By martinb0820 in forum Qt Programming
    Replies: 5
    Last Post: 23rd March 2012, 04:45
  2. Clickable text?
    By hkvm in forum Qt Programming
    Replies: 2
    Last Post: 27th September 2008, 21:49
  3. Clickable Qlabel
    By lewis in forum Qt Programming
    Replies: 11
    Last Post: 4th June 2008, 10:39
  4. QSqlRelationalDelegate Draw a clickable QToolButton
    By patrik08 in forum Qt Programming
    Replies: 5
    Last Post: 1st March 2007, 20:59

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.