Results 1 to 5 of 5

Thread: Open file from Qtext browser

  1. #1
    Join Date
    Dec 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Open file from Qtext browser

    I wrote a code to open file in gedit by clicking a link which is displayed in QTextBrowser. But file is not getting open in gedit instead it is displaying QTextBrowser itself. Here is my code
    Qt Code:
    1. void MainWindow::openTextEdit()
    2. {
    3. p->show();
    4.  
    5. p->append("<a href = \"/home/winbros/Test.cpp\"> Link </a>");
    6. p->setOpenExternalLinks(true);
    7. }
    To copy to clipboard, switch view to plain text mode 
    . Tanx in advance

  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: Open file from Qtext browser

    And where in the code you tell that you want to open it in gedit? Fetch the signal when the link is clicked and open gedit with a QProcess or so.

  3. #3
    Join Date
    Dec 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Open file from Qtext browser

    Sorry I dnt know about QProcess. Can you please give me a pseudocode for it. What if I want to open all formats like doc,xls,ods etc.

  4. #4
    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: Open file from Qtext browser

    In the manual you'll find a good explanation: QProcess, or have a look at QDesktopServices::openUrl ().

  5. #5
    Join Date
    Dec 2010
    Posts
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Open file from Qtext browser

    Could you please let me know how to keep track which link as been linked by the users. Further I looked into anchorclicked by I dnt how to use it in this context. P.S. I am using QT creator

Similar Threads

  1. Displaying the links in QText Browser
    By mecrazycoder in forum Newbie
    Replies: 0
    Last Post: 23rd December 2010, 19:28
  2. Replies: 1
    Last Post: 20th December 2010, 21:48
  3. How to open a browser ?
    By probine in forum Qt Programming
    Replies: 1
    Last Post: 4th December 2006, 18:21
  4. open a browser
    By npc in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 10:23
  5. How To Customize QText Browser
    By awalesminfo in forum Newbie
    Replies: 1
    Last Post: 21st March 2006, 12:04

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.