|
ChartDirector and QT 4.7.4 |
Posted by Christophe Conil on May-28-2012 08:13 |
|
Hello,
I'm interested in a Chartdirector license, and would like to try it out on QT. I allready downloaded the C++ Libraries, and every QT project works, except for qtdemo, which is quite limiting. (My biggest interest in on the gantt Charts)
Could you maybe have a look and see if this application works with newer version of QT? (I'm using the 4.7.4 on Windows system, but I guess I could update to a newer version if required).
Application simply crashes at startup (see screenshot)
Thank you very much,
Best Regards,
Christophe CONIL
|
Re: ChartDirector and QT 4.7.4 |
Posted by Peter Kwan on May-29-2012 05:19 |
|
Hi Christophe,
The qtdemo is basically a browser to browse and run the sample code. When it starts up, initially it will not create any charts. It will only create charts when after you selected a chart from the user interface (on the tree view on the left side).
If the qtdemo compiles successfully, and crashes immediately when it is run (before you can select the chart to create), I suspect the issue may be with the "browser" user interface, and not really with the charting part. (The charting code may work if copied to the "helloworld" sample project.)
I will try myself with QT 4.7.4. Would you mind to clarify if your using QT with the minGW compiler, or QT with Visual Studio as the compiler. Also, for the development IDE, are you using QT Creator or the Visual Studio (with the QT Plug-in)?
Also, from the screen shot, you seem to be using non-English Windows. Would you mind to inform me which language configuration of Windows you are using? (When QT starts up, instead of using the standard C Locale, it will switch to the locale of your operating system. I will try to use the same locale as your Windows to make sure I accurately duplicate your environment.)
If it is possible, may be you can set up some break points in the Qtdemo::Qtdemo routine in qtdemo.cpp, or you may single step the code there. These are the code that sets up the user interface. This will help us to determine where is the issue (in case we cannot reproduce the issue some reason).
Regards
Peter Kwan |
Re: ChartDirector and QT 4.7.4 |
Posted by Christophe Conil on Jun-02-2012 13:29 |
|
Hello,
Thank you very much for your response!! (And sorry for the delayed answer.)
I managed to correct the issue thanks to your hints:
The .pro file is obsolete for newer version of QT: The exe file is generated in the project directory, but libs are copied within an output directory.
I replaced the following content of the .pro file:
------------------------------
DEFINES += CHARTDIR_HIDE_OBSOLETE _CRT_SECURE_NO_WARNINGS
win32:DESTDIR = $$PWD
win32:LIBS += ../../lib/chartdir51.lib
win32:QMAKE_POST_LINK += copy /Y ..\\\\..\\\\lib\\\\chartdir51.dll
macx:CONFIG -= app_bundle
macx:DESTDIR = $$PWD
macx:LIBS += -L../../lib -lchartdir
macx:QMAKE_POST_LINK += cp ../../lib/libchartdir.5.dylib \\"$(DESTDIR)\\"
unix:!macx:DESTDIR = $$PWD
unix:!macx:LIBS += -L../../lib -lchartdir
unix:!macx:QMAKE_RPATHDIR += ../../lib
------------------------------
With the following one from hello.pro
------------------------------
DEFINES += CHARTDIR_HIDE_OBSOLETE _CRT_SECURE_NO_WARNINGS
win32:LIBS += ../../lib/chartdir51.lib
win32:QMAKE_POST_LINK = copy /Y ..\\\\..\\\\lib\\\\chartdir51.dll $(DESTDIR)
macx:LIBS += -L../../lib -lchartdir
macx:QMAKE_POST_LINK += mkdir -p \\"`dirname $(TARGET)`/../Frameworks\\";
macx:QMAKE_POST_LINK += cp ../../lib/libchartdir.5.dylib \\"`dirname $(TARGET)`/../Frameworks\\";
macx:QMAKE_POST_LINK += install_name_tool -change libchartdir.5.dylib \\
\\@loader_path/../Frameworks/libchartdir.5.dylib \\"$(TARGET)\\";
unix:!macx:LIBS += -L../../lib -lchartdir
unix:!macx:QMAKE_RPATHDIR += ../../lib
------------------------------
And It worked without any issue
Thanks!!
Best regards,
Christophe |
Re: ChartDirector and QT 4.7.4 |
Posted by Peter Kwan on Jun-03-2012 15:28 |
|
Hi Christophe,
Thanks a lot for your very useful information.
Actually, we have also found the issue, but I forgot to update this thread.
The issue we found is that in more recent versions of QT Creator, when you open the ".pro" file, it will prompt you on whether you want to build the system in a "shadow directory" or not. (I believe the default response is "yes".)
In the ".pro" file, the "destination directory" (the directory in which the EXE is created) is configured as the "project directory". Meanwhile, the "chartdir51.dll" is configured to be copied to the "current directory". It happens in recent versions of QT Creator, the "current directory" is treated as the "shadow directory" if the latter is enabled, and not the "destination directory".
In our own solution, the ".pro" file needs to be modified to:
win32:DESTDIR = $$PWD
win32:LIBS += ../../lib/chartdir51.lib
win32:QMAKE_POST_LINK += copy /Y ..\\\\..\\\\lib\\\\chartdir51.dll \\"$$PWD\\"
The ".pro" file in helloWorld.pro also works, but there is an issue. The qtdemo requires certain image files to demonstrate using icons, logos, background images, and so on in the charts. These images are in the project directory. That is why we need to set the destination directory to the project directory. In other QT project files, the destination directory is not set, because they are not dependent on other files in the project directory.
I suspect with your project file, the qtdemo run, but there may be no background images or icons in the charts. For example, if you try the "icon pie chart" sample code, are there any icons? In the "Background and Wallpaper" sample code, do you see any wallpaper or background images? I suspect for your project file, you may need to copy all the images (the .png, .jpg and .gif) to the output directory (which may be the shadow directory) to properly see the charts with icons and images.
Acutally, we have found another issue with qtdemo as well. In our testing, if the QT system is configured to use the Visual Studio compiler, the qtdemo may not compile, as it will complain about the unicode character type "wchar_t" being undefined. By default, "wchar_t" is a native type in both VC++ and gcc (just like "double" is native type) and should always be defined. However, we found that recent versions of QT Creator (we are testing using QT 4.8.1) will automatically add compilation flags to disable native type support for "wchar_t" in VC++ (not but not in gcc). I am not sure if this is specific to the VS2010 we are using, or to other VC++ versions as well.
Because of the above issues, we have updated the "ChartDirector for C++" distribution to use the modified ".pro" file, and also has updated the header files to make sure "wchar_t" remains defined even if QT explicity disable native type "wchar_t" support in VC++.
Regards
Peter Kwan |
|