Qt and chm help file format - c++

We want to move to Qt for our widget library. Currently we're using WX and it's compatible with chm. I can't find anything to suggest that Qt is the same. We've invested a bunch in CHM tools for the non-technical people to write help files.
Is there a way to view chm with Qt?
If not, is there a reasonably easy path from chm to whatever IS viewable from Qt?

Plain HTML definitely is. Qt contains a full HTML rendering core (WebKit).
Plus Qt has some internal format (packed HTML, similar to chm) https://doc.qt.io/archives/qq/qq28-qthelp.html
Oh and: http://web.archive.org/web/20120712115053/http://lists.trolltech.com/qt-interest/2005-03/thread00621-0.html explains how to open chm

Since you're using CHM you're probably not writing cross platform code. Just call ShellExecute passing the chm file full path name as parameter and Windows will open it for you.

Related

Qt Open file with context menu entry/shell extensions [Windows]

I'm looking to have a way of opening files in my Qt app within a context menu, like opening any image file in Photos or Photoshop. Mostly what I'm finding though is either possibly out of date ways of doing it, like way earlier versions of Qt, or incomplete posts about doing something with shell extensions, but it's mostly adding an icon to custom file extensions in explorer, not the opening actions. Or ways of doing it with the general Windows API I think, which I don't know how this would "connect" with my Qt app to open a file in it, and the windows api is very scary to me.
Is the way of doing now with a newly added module in Qt using C++, or maybe something with an "installscript.qs" file, or "package.xml"? I've never seen or used a .qs file before. Basically, I'm not sure where to look for how to do it the most updated and easiest way.
The screenshot below is an example of the functionality im talking about. With my Qt app not being open, a file of the types I want (.jpg, .png, .gif, etc) is right clicked, and I can click like "Edit with MyQtAppName", or open the "Open with" sub menu and click "MyQtAppName". Then ultimately this files full path would be passed into my Qt app as a string somehow. I don't know how this pass of the path string happens yet, but yeah. Any help appreciated.

How to choose and open a file during runtime with C++?

At the moment I am creating an Editor for Textures and I want to choose the textures during runtime. Later I would like to choose the save directory for new textures.
I found the
How to: Open Files Using the OpenFileDialog Component. But I think this is not the solution.
(assuming you are on Windows, pas per screenshot)
If you simply want to select a folder, you can use SHBrowseForFolder.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762115%28v=vs.85%29.aspx
M.
You need to look at the Common Dialog Library.
http://msdn.microsoft.com/en-gb/library/windows/desktop/ms645524(v=vs.85).aspx
Or, if you are only interested in Vista/Windows 7 support, you could consider the Common Item Dialogs instead.
http://msdn.microsoft.com/en-gb/library/windows/desktop/bb776913(v=vs.85).aspx
For 'native' C++ you wouldn't be able to easily use the .NET components that your link refers to.
I have solved my problem with using the dirent.h file. I have acknowledge of this file by founding this post How can I get the list of files in a directory using C or C++?
I have write my own fileexplorer by using dirent.h and SFML.
Sorry if i can't illustrate my problem.
but thanks for the replies (:

Using OpenStreetMap in my c++ program

I have a gpx file. I need a open source library that i can give it the gpx file and that it will present the route on a map. Does anyone know such a thing?
I'm writing in c++ on windows xp.
thanks in advance!!
There exists a bunch of Frameworks to map the OSM APIs to different languages.
Please check out this wiki-page from OSM: http://wiki.openstreetmap.org/wiki/Develop/Frameworks
I think what you search for can be found under Widgets like for example "COSMCtrl 1.1.3"

How to open and display a PDF file using Qt/C++?

I am trying to open and read a PDF file using Qt, but there is no specific way to do that.
I know the subject is a bit old, but...
I found a really simple way to render PDFs in Qt via QtWebKit using pdf.js (http://mozilla.github.com/pdf.js/).
Here is my realization of the idea for Qt5 and the WebEngine: https://github.com/Archie3d/qpdf
Qt itself does not include PDF reading/rendering functionality as far as I know. You might want to have a look at libpoppler which has Qt bindings.
I found this very interesting article on qt-project.org - "Handling PDF - Qt Project".
This page discusses various available options for working with PDF documents in a Qt application. The page does not exactly show how to "open and display an existing PDF document" but it can help you deduce something useful out of all that is explained there.
Here, the page says:
For rendering pages or elements from existing PDF documents to image
files or in-memory pixmaps (useful e.g. for thumbnail generation or
implementing custom viewers), third-party libraries can be used (for
example: poppler-qt4 (freedesktop.org) and muPDF (mupdf.com)).
Alternatively, the task can be delegated to existing command-line
tools (like poppler-utils (freedesktop.org) and muPDF (mupdf.com)).
You can use PdfViewer which is a lightweight PDF viewer that only uses Qt. It contains a PdfView widget which can be easily embedded in your application.
Simple answer : it is not supported in the Qt API.
Other answer : you can code it, I suggest you have a look at this Qt application which uses Ghostscript
The best way I have found to open a pdf is using QProcess in Qt.
You may want to use okular for pdf proccessing.
I know this is an old post, but I stumbled on it during my initial search so I figured I would post some documentation from the solutions I used.
As of Qt 5.10
Check out the QPdfDocument Class. This class can open a PDF and you can use the render function to render a page to an image. I use the QQuickPaintedItem to then "draw" this image but I am sure there are more ways to handle the QImage output.
Prior to Qt 5.10
I used libpoppler to do a VERY similar process.
#include <poppler/qt5/poppler-qt5.h>
Use the Poppler::Document Class to load and handle the entire PDF document and look at the Poppler::Page::renderToImage function to output the page as a QImage.
Qt does not support reading PDF files out of the box and among many approaches you can use Adobe's PDF Reader ActiveX object along with a QAxObject.
You may want to check out this link which describes how to read PDF files in Qt/C++ using ActiveX and has a downloadable example project.

C++ Library to render ODF documents?

I am unable to find any open source libraries to render ODF documents using C++. I found ODKit suporting Java and AODL for .NET C#.
Does any one have any idea or provide me any pointers.
I found a Qt source to parse ODF. Qt already has built in ODF writer.
KOffice supports ODF and is written in C++. I suspect they may have solved whatever it is you are trying to solve. http://www.koffice.org
It may not be the most elegant solution but OpenOffice itself is capable of rendering and the OOoSDK can be used from C++ as seen here for writer and here for spreadsheet.
There is none. You're better AODL or any of the other libs available (python, perl, java, etc) and doing a binding to it
KOffice can be an idea, but if I just want to display an odt file in a nice Qt QWidget, but I don't want to depends on DBus and a lots of Kde feature.
The Idea is to take a look a Flake and KoText libs as Thomas Zanders says on this Forum.