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.
Printable View
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.
Either use "What's this" capabilities or look at the simple help browser video.
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 ?
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.
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 ?
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.
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 :o
Stil cant integrate it to my application :(
I have it like this:
main.cpp
Code:
int main(int argc, char *argv[]) { ImageViewer imageViewer; imageViewer.show(); return app.exec(); }
imageviewer.h
imageviewer.cpp
Code:
ImageViewer::ImageViewer() { Ui::MainWindow ui; ui.setupUi(form); } void ImageViewer::createActions() { helpAct->setShortcut(tr("Ctrl+H")); connect(helpAct, SIGNAL(triggered()), this, SLOT(help())); } void ImageViewer::help() { statusBar()->showMessage(tr("Help")); form->show(); }
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 :D
This should be a member variable of the ImageViewer class.Quote:
Originally Posted by Godlike
Make sure that you have #include "ui_something.h" and that your form is named MainWindow (check objectName property in the Designer).
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 :eek:
Anything i made wrong, again ? :crying:
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 :p
I just made it when i called help(), works fine. Sorry for asking too soon.
Thanks for all the help. Great forum!
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.Quote:
Originally Posted by Godlike
BTW. It would be better if you create a separate class for that help browser.