Results 1 to 10 of 10

Thread: QLabel's linkActivated() signal in QT 4.2

  1. #1
    Join Date
    May 2006
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Question QLabel's linkActivated() signal in QT 4.2

    I've compiled and installed QT 4.2.2 OpenSource version for linux. I noticed the documentation says there are two new signals for the QLabel object. Those are linkActivated() and linkHovered(). I tried to connect the linkActivated() signal for one of my working app's to a slot. The app's form was created via QT Designer. It compiles fine, no errors or warnings. When I run the app, I get a message that the signal does not exist. Does anyone know what I may be missing?

    Thanks,
    Glenn

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QLabel's linkActivated() signal in QT 4.2

    could you show us your connect() statment and the error from the console (copy paste)

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QLabel's linkActivated() signal in QT 4.2

    Most probably you've run onto one of these.

  4. #4
    Join Date
    May 2006
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QLabel's linkActivated() signal in QT 4.2

    I'm not at home, so I cannot send you the message from KDevelop. Here is the connect string I used in my app's constructor:

    connect(label_2, SIGNAL(linkActivated()), this, SLOT(myslot()));

    From what I saw in the link Wysota had in his reply my connect string should be like this:

    connect(label_2, SIGNAL(linkActivated(const QString & )), this, SLOT(myslot()));

    Is that correct?

    Thanks,
    Glenn

  5. #5
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QLabel's linkActivated() signal in QT 4.2

    actually it should be:
    connect(label_2, SIGNAL(linkActivated(const QString & )), this, SLOT(myslot(const QString &)));

  6. #6
    Join Date
    May 2006
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QLabel's linkActivated() signal in QT 4.2

    Thanks for the help. I'll try it out tonight.

    This is probably a dumb question, but what does the (const QString & ) reference?

  7. #7
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QLabel's linkActivated() signal in QT 4.2

    From the docs:
    void QLabel::linkActivated ( const QString & link ) [signal]

    This signal is emitted when the user clicks a link. The URL referred to by the anchor is passed in link.

    This function was introduced in Qt 4.2.

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QLabel's linkActivated() signal in QT 4.2

    The slot can have no arguments, but I doubt you'll be able to do anything useful then

  9. #9
    Join Date
    May 2006
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QLabel's linkActivated() signal in QT 4.2

    OK. Thanks again. I'm not trying to open a link. I'm filling a QPUListView object with QLabel objects. This would be similar to some of the Task Panel tasks you see on some .Net applications. When the user clicks the label, it needs to emit a signal so the connected slot can be executed. Hopefully the linkActivated signal will work.

  10. #10
    Join Date
    May 2006
    Posts
    20
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QLabel's linkActivated() signal in QT 4.2

    Thanks Guys. That worked. Once I realized how to set the anchor and link via QT Designer, it worked perfectly.

    Glenn

Similar Threads

  1. Signal and slots
    By villy in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2007, 10:10
  2. Replies: 2
    Last Post: 17th May 2006, 21:01
  3. no such signal QListBox::currentChanged()
    By jopie bakker in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 15:17
  4. send signal from QCombobox
    By raphaelf in forum Qt Programming
    Replies: 22
    Last Post: 28th February 2006, 14:18
  5. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52

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
  •  
Qt is a trademark of The Qt Company.