Results 1 to 8 of 8

Thread: How to create a HyperLink in Qt 4.1.5?

  1. #1
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question How to create a HyperLink in Qt 4.1.5?

    Hi All,

    I m using Qt 4.1.5 on my Intel Mac.
    I want to create a Link in Qt. I can make a Link in Qt 4.2.2 but Actually QT 4.2.2 does not give support to MAC 10.2 so I have to use Qt 4.1.5.

    So If anybody knws then plz help me.

    Thanks.

  2. #2
    Join Date
    Apr 2007
    Posts
    44
    Thanks
    6
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: How to create a HyperLink in Qt 4.1.5?

    Sub class QPushButton

    reimplement all of these events

    virtual void enterEvent(QEvent *);
    virtual void leaveEvent(QEvent *);
    virtual void paintEvent(QPaintEvent *);

    You can change mouse cursor when mouse enter
    and change back when mouse leave

    painter use for Draw Text look like link color

  3. #3
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create a HyperLink in Qt 4.1.5?

    Or use a QLabel or QWidget to do the same thing, because QPushButton is too "heavy" for such a small task.

    Regards.

  4. #4
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to create a HyperLink in Qt 4.1.5?

    Quote Originally Posted by vishal.chauhan View Post
    Hi All,

    I m using Qt 4.1.5 on my Intel Mac.
    I want to create a Link in Qt. I can make a Link in Qt 4.2.2 but Actually QT 4.2.2 does not give support to MAC 10.2 so I have to use Qt 4.1.5.

    So If anybody knws then plz help me.

    Thanks.



    Link?? a href link or start a link file like a pdf same as terminal:
    mac:

    open file.pdf

    http://doc.trolltech.com/4.2/qdesktopservices.html



    Qt Code:
    1. /* qt2 > */
    2. void FullEdit::OpenDesktop( QUrl loc )
    3. {
    4. qDebug() << "#### OpenDesktop " << loc;
    5.  
    6. #if defined Q_WS_WIN
    7.  
    8. QString winbuh = DesktopFile(loc.toString()); /* attach file:// if a local url */
    9. /* QUrl(winbuh) */
    10.  
    11. bool wr = QDesktopServices::openUrl(loc);
    12. if (!wr) {
    13. QMessageBox::warning(0, tr("Error"),tr("Unable to open file or dir %1").arg(loc.toString()));
    14. }
    15. return;
    16. #endif
    17.  
    18.  
    19. bool r = QDesktopServices::openUrl(loc);
    20. if (!r) {
    21. QMessageBox::warning(0, tr("Error"),tr("Unable to open file or dir %1").arg(loc.toString()));
    22. }
    23. }
    24.  
    25.  
    26. /* qt2 < */
    27.  
    28.  
    29. void ClassName::OpenUrl_File_Dir_Dektop()
    30. {
    31. #if defined(Q_WS_WIN)
    32. s << "url.dll,FileProtocolHandler" << "http://www.qtforum.de/forum/";
    33. p.startDetached(QString("rundll32.exe") , s );
    34. #endif
    35. #if defined Q_WS_MAC
    36. macs << "http://www.qtforum.de/forum/"; /* oeffnet der default browser */
    37. m.startDetached(QString("open") , macs );
    38. #endif
    39. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    May 2006
    Posts
    788
    Thanks
    49
    Thanked 48 Times in 46 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to create a HyperLink in Qt 4.1.5?

    ONLY on MAC!
    IMO...
    if you show last line from http://www.qtforum.de/forum/viewtopic.php?t=2366 only source ...

    you can make applescript and set image backround or other 1000 way applescript ... like make a coffe...

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

    Default Re: How to create a HyperLink in Qt 4.1.5?

    Patrick... the question was about Qt 4.1. And it was about displaying a link and not opening pdf files...

  7. #7
    Join Date
    Dec 2006
    Posts
    211
    Thanks
    27
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Re: How to create a HyperLink in Qt 4.1.5?

    Thanks for Reply.

    But as Wysota said question was how to create hyperlink in Qt 4.1.5 not in Qt 4.2.

  8. #8
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to create a HyperLink in Qt 4.1.5?

    Look at posts #2 and #3.

    Regards

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.