Results 1 to 20 of 21

Thread: QTextBroxser : home() problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTextBroxser : home() problem

    It seems to work quite fine for me... Check the attached ui file (adjust the source to match your Qt docs index.html). Also be sure to always change the active document using setSource().
    Attached Files Attached Files

  2. The following user says thank you to wysota for this useful post:

    Nyphel (24th May 2007)

  3. #2
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QTextBroxser : home() problem

    Thanks Wysota, I didn't saw the answer before

    This works well !

    I had reimplemented the slots that could be set with the QtDesigner and I made an error.
    I set the home_button to perform
    Qt Code:
    1. my_text_box->home();
    To copy to clipboard, switch view to plain text mode 
    Certainly should I set :
    Qt Code:
    1. my_text_box->setSource(home());
    To copy to clipboard, switch view to plain text mode 

  4. #3
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QTextBroxser : home() problem

    Hi,

    I don't understand why but I can't make my browser to work.
    When I execute my app, the browser is wide, clean, cleared...
    When I open the .ui file, the browser looks well and the html content is displayed.
    When I preview the .ui file, the browser is wide, clean, cleared...

    The source is set in the .ui file, and never modified in my source code.

    The only thing I've done since the last two weeks is to rebuild my Qt Open Source editon with the following configure.cache (under Win2000) :
    Qt Code:
    1. -release
    2. -static
    3. -fast
    4. -no-exceptions
    5. -no-dsp
    6. -no-vcproj
    7. -no-rtti
    8. -no-style-windowsxp
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: QTextBroxser : home() problem

    You're probably using a relative path for your source and Qt can't find it once the binary is moved to other place (like debug or release folders).

  6. #5
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QTextBroxser : home() problem

    Yes this is a relative path : ../../help/help.html

    This relative path is the same path for my .ui file and my .exe file.

    Qt Code:
    1. my_project
    2. |-- help
    3. | |-- help.html
    4. |
    5. |-- gui
    6. | |-- gui
    7. | |-- help.ui
    8. |
    9. |-- my_app
    10. | |-- { sources }
    11. | |-- release
    12. | |-- my_app.exe
    To copy to clipboard, switch view to plain text mode 

    But what I don't understand is that I don't move my application when I want to test it
    Moreover I must set a relative path, cause this application will be deployed on ifferent OS (Linux, Win98, Win2000 and WinXP). Isn't it possible ?

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

    Default Re: QTextBroxser : home() problem

    You can embed the files you need into your executable and use the resource system to access them.

  8. #7
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QTextBroxser : home() problem

    Mmmhhh... I think that this solution wouldn't be the best for me

    I use a TextBrowser in order to be able to modify the help file without a complete rebuild of my application. So, if I embed it in the ressources file, wouldn't I lost this ability ?
    Last edited by Nyphel; 24th May 2007 at 12:47.

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

    Default Re: QTextBroxser : home() problem

    You can do the embedding only when your application is being released and use real files when developing. Alternatively use file path relative to QApplication::applicationDirPath(), just make sure they are always correct. For example Windows compilers tend to move your application to different directories when compiling.

  10. The following user says thank you to wysota for this useful post:

    Nyphel (25th May 2007)

  11. #9
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QTextBroxser : home() problem

    That's a great idea, thanks Wysota, but it doesn't resolve my problem

    I think my installation is broken, cause it has worked very well before I rebuild my Qt Open Source edition with the static option.
    Moreover, my compiler doesn't move the file while compiling (I've checked this point to be sure) and I'm pretty sure that if the QtDesigner editor can read the HTML file while editing the .ui, it should be able to read the content while doing the preview (with CTRL+D).

    I don't really know what to do, but thanks for your help and tips, that helped me

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

    Default Re: QTextBroxser : home() problem

    Could you prepare a minimal compilable example that reproduces the problem?

  13. #11
    Join Date
    Feb 2007
    Posts
    158
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    25

    Default Re: QTextBroxser : home() problem

    I'm a .ui file similar to yours

    The difference is that I'm under Win2000 and my path to the HTML file is [../../aide/accueil.html] and not [/usr/share/doc/qt4/doc/html/index.html].
    ("aide" stands for "help" in french)

    I generate the header file with the command :
    uic aide.ui -o aide.h

    And I use an implementation class...



    Here is my HTML :
    Qt Code:
    1. <html>
    2. <head>
    3. </head>
    4.  
    5. <body>
    6. huhuhuh hin hin hin !
    7. <br /><br />
    8. <a href="suite.html">a link</a>
    9. </body>
    10.  
    11. </html>
    To copy to clipboard, switch view to plain text mode 
    (I made some links to test the forward/backward/home functionnalities)



    Here is my implementation class :
    Qt Code:
    1. #ifndef Aide_impl_h
    2. #define Aide_impl_h
    3.  
    4. #include "../gui/gui/ui_aide.h"
    5.  
    6. #include <QObject>
    7. #include <QDialog>
    8. #include <QtGui>
    9. #include <QUrl>
    10.  
    11. class Aide_impl : public QDialog, public Ui::dialog_Aide
    12. {
    13. Q_OBJECT
    14.  
    15. public:
    16. Aide_impl(QWidget *parent = 0);
    17.  
    18. protected:
    19.  
    20. private slots:
    21.  
    22. private:
    23. };
    24.  
    25. #endif // Aide_impl_h
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. Aide_impl::Aide_impl(QWidget *parent) : QDialog(parent)
    2. {
    3. setupUi(this);
    4. }
    To copy to clipboard, switch view to plain text mode 



    And I use it in my application :
    Qt Code:
    1. Aide_impl my_help_window = new Aide_impl(this);
    2. my_help_window->show();
    To copy to clipboard, switch view to plain text mode 

  14. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,376
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Thanks
    4
    Thanked 5,019 Times in 4,795 Posts
    Wiki edits
    10

    Default Re: QTextBroxser : home() problem

    So where do you set the path?

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 13:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 13:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 15:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 22:36
  5. Replies: 16
    Last Post: 7th March 2006, 16:57

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.