Results 1 to 10 of 10

Thread: Making some simple help for my application

  1. #1
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Making some simple help for my application

    How can i make some little help when i click on a help button.
    Something like this here:

    http://img81.imageshack.us/my.php?image=untitled3sj.jpg

    Is there some example how i can make this window here ?

    Thx.

  2. #2
    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: Making some simple help for my application

    Either use "What's this" capabilities or look at the simple help browser video.

  3. #3
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Making some simple help for my application

    Ok used the video, all fine. But i cant get that include right: ui_browser.h

    When i compile it doesnt find it. It must be in the directory where i compile probably, so where can i get that file ?

  4. #4
    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: Making some simple help for my application

    It should get created by uic from your ui file. Make sure the ui file you created in Designer is mentioned in the FORMS section of the project file.

  5. #5
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Making some simple help for my application

    I made that form in the QT designer 4.0 and then when i was done i saved it as form.ui and that is all i have in my directory. So where should i check that what you said ?

  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: Making some simple help for my application

    The .pro file should contain an entry in its FORMS section about that designer made file. If it doesn't have it, you should add FORMS+=filename.ui and rerun qmake.

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

    Godlike (21st April 2006)

  8. #7
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default

    It contains it.

    FORMS += form.ui

    it was there from beggining.

    ahhh its ui_form.h not same as by the example because i changed name
    Stupid me

    Stil cant integrate it to my application

    I have it like this:

    main.cpp

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication app(argc, argv);
    4. ImageViewer imageViewer;
    5. imageViewer.show();
    6. return app.exec();
    7. }
    To copy to clipboard, switch view to plain text mode 

    imageviewer.h

    Qt Code:
    To copy to clipboard, switch view to plain text mode 

    imageviewer.cpp

    Qt Code:
    1. ImageViewer::ImageViewer()
    2. {
    3. QMainWindow *form = new QMainWindow;
    4. Ui::MainWindow ui;
    5. ui.setupUi(form);
    6. ui.textBrowser->setSource(QString("/home/godlike/RA/test/index.html"));
    7. }
    8.  
    9. void ImageViewer::createActions()
    10. {
    11. helpAct = new QAction(tr("&Help"), this);
    12. helpAct->setShortcut(tr("Ctrl+H"));
    13. connect(helpAct, SIGNAL(triggered()), this, SLOT(help()));
    14. }
    15.  
    16. void ImageViewer::help()
    17. {
    18. statusBar()->showMessage(tr("Help"));
    19. form->show();
    20. }
    To copy to clipboard, switch view to plain text mode 

    I only pasted relevant code for this problem. I will paste the error i get from compile:

    imageviewer.cpp:26: error: ‘MainWindow’ is not a member of ‘Ui’
    imageviewer.cpp:26: error: expected `;' before ‘ui’
    imageviewer.cpp:27: error: ‘ui’ was not declared in this scope

    Something with that Ui but i dont know what i did wrong with it.
    Thx for help so far, help abit more and i will learn something new again
    Last edited by wysota; 21st April 2006 at 18:30. Reason: Merged multiple posts

  9. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making some simple help for my application

    Quote Originally Posted by Godlike
    Ui::MainWindow ui;
    This should be a member variable of the ImageViewer class.

    Make sure that you have #include "ui_something.h" and that your form is named MainWindow (check objectName property in the Designer).

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

    Godlike (21st April 2006)

  11. #9
    Join Date
    Mar 2006
    Posts
    26
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default

    Yep moved to .h file and corrected the name. Compiles great now. But if i click my button help, signal connects to function help(), its posted one post above, i get segmentation fault and my app crashes

    Anything i made wrong, again ?

    Though it had to do something that i used QMainWindow so i made it as QWidget, still same problem, but if i move my form->show(); out of help() to the top where i do ui.setup ... it goes fine, but it starts when program starts, i want it to show when i click on help, so how can this be done correctly ?

    Argh, got it. Why would i make that widget before calling help() thats stupid

    I just made it when i called help(), works fine. Sorry for asking too soon.

    Thanks for all the help. Great forum!
    Last edited by wysota; 21st April 2006 at 18:29. Reason: Multiple posts

  12. #10
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Making some simple help for my application

    Quote Originally Posted by Godlike
    ImageViewer::ImageViewer()
    {
    QMainWindow *form = new QMainWindow;
    ...
    }
    You have two form variables --- one is a member variable in of the ImageViewer and another one is a local variable that you use in the constructor. There should be only one.

    BTW. It would be better if you create a separate class for that help browser.

Similar Threads

  1. QSkinWindows Classes
    By kernel_panic in forum Qt-based Software
    Replies: 45
    Last Post: 20th April 2010, 12:35
  2. Replies: 3
    Last Post: 3rd March 2009, 12:24
  3. Framebuffer and simple launcher of application
    By damien in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 6th February 2009, 21:33
  4. a simple application
    By aegis in forum Qt Programming
    Replies: 6
    Last Post: 12th March 2007, 15:04
  5. Replies: 2
    Last Post: 12th January 2007, 11:19

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.