Results 1 to 2 of 2

Thread: Linking text in qlineedit to URL

  1. #1
    Join Date
    Dec 2016
    Posts
    15
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Linking text in qlineedit to URL

    I am currently using a QLineEdit widget to input some text, which is the linktext to a predefined hyperlink.
    When the user clicks on the text in the QLineEdit, it should open up the URL in the browser, and pass the link text as an argument.

    How do I associate a URL to the QLineEdit?

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Linking text in qlineedit to URL

    There are various ways to detect a click in a widget.

    One is to derive from the widget class in question, in your case QLineEdit, and implement mousePressEvent() and mouseReleaseEvent().
    Another is is to install an event filter that checks for these events.

    Cheers,
    _

Similar Threads

  1. QlineEdit with constant text and editable text fields
    By arunpk in forum Qt Programming
    Replies: 6
    Last Post: 17th November 2015, 12:38
  2. Replies: 1
    Last Post: 11th March 2014, 11:20
  3. QTableWidgetItem text() function not linking ?
    By marcvanriet in forum Newbie
    Replies: 4
    Last Post: 10th September 2010, 15:45
  4. QLineEdit text orientation
    By emrares in forum Qt Programming
    Replies: 7
    Last Post: 15th September 2009, 06:25
  5. QLineEdit, draw only text
    By Radagast in forum Qt Programming
    Replies: 1
    Last Post: 28th March 2009, 11:15

Tags for this Thread

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.