Help Integration in Qt/C++ Application - c++

I am using Qt 4.6 so do C++.
I have a User Manual (.chm) for my application which has the help required for the users to run the application. Now I want this help to be integrated into my application, so that when the user selects for help from the application, the user manual will be opened with the corresponding help page displayed. In this way I can make use of the already available manual and users will find easy to probe through the document. (since it is familiar)
The user manual file is in the .chm format which has corresponding search keywords, which can be used to display the corresponding page when selected from the application. Just similar to F1 help in any of the windows application.
Is it possible to do this in Qt or C++? Or
What are the other ways through which the help can be integrated in the application?
Any pointers regarding this are welcome..

Yes, it's possible. The help system infrastructure was designed to integrate with normal Win32 development in Visual Studio, but this is not technically necessary. Basically you just call HtmlHelp(GetDesktopWindow(), "Yourhelp.chm", HH_HELP_CONTEXT, IDYourCurrentContext);.

The more Qt way of Help Integration can also be done which is as follows.
The chm files are always opened by the hh.exe
So,
QProcess::execute("hh.exe D:/Manual.chm");
can be used to open the Manual.chm file from the application.
The command
QProcess::execute("hh.exe D:/Manual.chm::page1.htm");
will open the chm file with the page1.htm loaded. This will be helpful to load a specific help page in the chm file.
The only thing we must be aware in this approach is that we must have known the file name of the web pages (here page1.htm) previously..
Hope this one also helps... :)

QDesktopServices::openUrl() would be even more Qt way. Then you do not need to specify hh.exe but rely instead on the system file associations to use proper application. Hence - portability, the key thing behind Qt stuff.

try using libCHMxx or CHM lib along with Qt help system (see this sample)

Related

open window to choose images c++

I am using c++ in ubuntu 12.04 using gcc. Am trying to perform few image processing tasks using opencv. For this, I want the user to select an image. Is it possible to open the directory explorer through c++, and let user choose the image, by selecting folders or drives, etc.? I actually did not know how to google this question exactly, my apologies if this is pretty rudimentary. Your help is much appreciated. Thanks in advance
You will want to use a GUI toolkit like Qt. They ususally have some sort of function for what you want. In the case of Qt the QFileDialog would be good.
For learning Qt: There are official tutorials or maybe this question.
If you want to go down this route you can also use a completely separate program just for getting a file name. Something like zenity maybe. Which platform do you want to do this on?

How to add custom menu upon right click on file / folder programmatically in c++ / QT?

We have an app which syncs files and folder like the way dropbox does. This is an c++ / QT based installer.
We would like add custom menu in the right click context menu of a file or folder like the way dropbox does in the below screen shot.
We are targeting both windows & Mac platforms. Can anyone suggest me how to start with it?
On Mac, you're going to have problems as adding to the general Finder Context Menu has been deprecated.
So, you may be thinking, if it's deprecated, then how do Dropbox do this? From what I've researched in the past, I believe they use code injection to inject into the running Finder application's address space and then an Objective-C feature known as method swizzling to change calling a method to one of their own, which is located in the injected code.
This is all fairly hardcore and very low level, but if you're going to go on that journey, you can start by looking into a library called mach_inject and googling about it. The source code can be found here: -
https://github.com/rentzsch/mach_inject
However, be aware that there are those that believe code-injection is wrong and won't install Dropbox or any other software that uses it. In addition, if you're planning on releasing a product in the Mac Store, I wouldn't expect any application that performs code injection to be allowed.
For windows, I could find a complete Shell extension example over here.
http://www.codeproject.com/Articles/441/The-Complete-Idiot-s-Guide-to-Writing-Shell-Extens?fid=519&select=3236397&fr=76&df=90&mpp=25&noise=3&prof=True&sort=Position&view=None&spc=Relaxed

QT Style Comments (Intellisense?)

I noticed in 2.1 of QTCreator, that they now have a sort of intellisense similar to that of Visual Studio. I know intellisense is Microsoft's name for this concept of the helpful tooltip that pops up giving you a description of the method, parameters etc so i don't know what this is actually called. Does anyone know how to add these type of pop-up comments to methods and classes in QT?
Again to clarify what i'm talking about are like javadoc comments or the "///" in C#. I'm hoping the devs of QT have a way for the users to make their own comments.
Thanks for the help,
Jec
I've been wanting to do this as well.
I found this thread over on qtCentre.org where someone has integrated their own docs into the QT Creator Tooltips. I haven't tested it myself, but it sounds reasonable:
http://www.qtcentre.org/archive/index.php/t-40324.html?s=98d48c38547da14b0725e5106d83c315
To use your own documentation in Qt
Assistant (and in Qt Creator help as
well) you need to create Qt Compressed
Help file (.qch
(http://doc.qt.nokia.com/4.7/assistant-custom-help-viewer.html#displaying-custom-documentation))
and register it in Assistant and
Creator. Doxygen has several tools
exactly for Qt. There are tags in it's
config file, that help you to create
the documentation exactly the way you
need. E.g. with GENERATE_QHP tag you
can make it create the ready qhp
(http://doc.qt.nokia.com/4.7/assistant-custom-help-viewer.html#creating-a-custom-help-collection-file)
(Qt Help Project) file (you need this
to generate the .qch). If you don't
need to edit this file manually before
creating the .qhc, you can set the
value of QHG_LOCATION tag to the
location of your qhelpgenerator.exe
(usually it's here (in Windows):
/mingw/bin/qhelpgenerator.exe)
and it will generate the ready
documentation. Register it in Qt
Assistant (optional) and Creator and
you're done. After this all your
documented types, functions, members,
etc. will have the tooltip with F1
button hint. And of course pushing F1
will show your documented help for it.

Look for ways to enable printing from my C++/MFC application

Since time immemorial I've been trying to avoid printing from my Windows-based applications due to the lack of native support for it. Whenever absolutely necessary I was resorting to dynamically making a simple HTML layout and then opening it in a web browser with a short Java Script in it to pop up a printing dialog for a user. Now I need to find something more substantial.
Let me explain. I have a project that deals with medical charts and it has to be able to print into those charts (at specific locations) as well as print on to a Letter/A4 size page in general. It also has to provide a preview of what is being printed in a paged-view environment.
In light of that I was wondering what is available from MFC/C++ environment (not C#) in regarding to printing?
PS. I was thinking to look into the RTF format but that seems like quite a daunting task, so I was also wondering, is there any libraries/already written code that can allow to compose/view/print RTFs? If not, what else is out there that can provide printing support like I explained above?
"lack of native support"? It's been covered by Petzold since forever, and it's integrated straight into GDI. Compared to UNIX, it's a complete breeze. And MFC makes it even easier.
Anyway, here's how you do print preview with MFC, and here's how you subsequently print. Lots of links from there, and it's all straightforward. Printers are just another Device Context on which you can draw.
I always found it very convenient to generate PDF files from my MFC/C++ application, There are many libraries out there which enable easy creation of PDF files, preview functionality and so on (also open source). I'm using this (also handles RTF):
PDF Library
There is no support like you call a framework method with some parameters and the framework prints a document or the content of a window for you. You need to manually draw everything on the printing device context. So as already said, you might find it more convenient to use a PDF generator, but of course that depends on your application requirements.
Please try www.oxetta.com , it's a free report builder solution that easily integrates into a C/C++ application.

to program GUI app , what will be the must user and developer frendly toolkit in c++

i like to build desktop application , that will be must user friendly in view
what i mean is that the look and feel will be natural in the way the user used to see windows
apps .
and this toolkit/framework to be as much as possible easy fast to develop from the developer side in c++ .
Could we ask some more questions, what do you mean by user friendly(system integration easy keybingings/Accessibility)?
Which platforms(windows only? You seem to indicate this, if so xp-7?
Would fairly easy crossplatform support be a plus))?
Do you want a form builder? an ide? special libraries?
open source or closed source?
do you mind paying?
qt is probably the most recommended
option although there is also
FLTK
Juce
wxwidgets
gtk+(c based or use with gtk-- a c++ wrapper)
I'd go with Qt.
It's a mature cross platform library that is easy to setup and to use. There's also a ton of resources available. The QT designer can also help you to quickly create your forms. There's even a visual studio plugin for it!
As others have pointed out Qt is a great choice. I went through the same search when I started coding C++ coming from Delphi, and this is where Qt shined. It was the only option I found that offered a complete solution: GUI, DB access, cross-platform system calls (file-access, start-processes), XML, native platform configuration (text files in *nix, win-registry, etc), multi-threading.
It was a one-stop shop for everything I needed.