QML error says that svg is unsupported - qt

I've used plugins before, but after I recompiled my qt libraries, I haven't been able to successfully use .svg image files any longer. There error I get is as follows:
file:///C:/Users/RBhatia/Documents/SettingsMenu/SettingsMenu/SlicingComp.qml:41:5: QML Image:
Error decoding:
file:///C:/Users/RBhatia/Documents/SettingsMenu/SettingsMenu/img/sliceStep_slice1.svg: Unsupported image format
I have checked all my .dll files to make sure they are in 64 bit format. I also checked my environment variables, and even tried to use different librariesm but I simply cannot figure out what changed to cause this issue.

The problem is not missing header files. It's due to missing dependencies to Qt libraries as mentioned in that comment here: Comment by JamesL
To use SVG images you need to specify QtSvg, QtXml, QtGui, and QtCore to be deployed with your project.

The most probable reason I can think of is that you were missing some svg header files when you compiled your qt. If you do not add -svg to your configure, svg is treated as optional. Means if everything is there to build the svg plugin, it is build, else this feature is silently dropped.
You said, you checked your .dll files. Did you also check the plugins folder? Something like $QTDIR/plugins/imageformats. Must contains a qsvg4.dll. Or qsvg5.dll for Qt5.

Related

Mysterious Qt undefined interface : investigation

I am writing a typical Qt (4.8.2) app with plugins. One of the plugins includes a couple custom interfaces, by calling the Q_INTERFACE macro. Those interfaces are found in .h files visible to the project (via the .pro includes) and they all contain a macro call to Q_DECLARE_INTERFACES.
Yet upon compiling the moc file I get an undefined interface error in the main .h file of the plugin. It doesn't tell me which though, it only specifies the line of the first (I tried changing the order but it makes no difference - unless all interfaces are affected - heck, who knows, that could be the case.)
This plugin works at other people's desks. Some of the stuff in the main app is written with Qt 5 but always with macros to check for the version and include other code for earlier versions like mine. This also works at other people's desks who work with 4.8.2 for their plugins.
Where to look for the cause of that error ?
I don't know why my question got voted down, but here's the answer :
With the copy of the project I also received the moc_*.cpp files and some files called mocinclude.tmp . This was a first git add mistake.
But there is another problem : at least the latter (if not the former) does not get cleaned properly or recreated by Qmake/make clean.
A third problem : In mocinclude.tmp there were absolute file paths from the computer where the project was first created, which wasn't mine. Relative paths would have been less error-prone.
Those wrong absolute paths led to the "undefined interface" error (which is nothing less but a "file not found" error in the case of a needed interface file) when compiling the moc files.
Deleting all mocinclude.tmp (and moc files) solved my problem.
(I also made sure to tell git to not track them anymore.)

How to add an external library to QT?

I am trying to create a project assosiated with the SimConnect SDK.
I am new to QT, and in Visual Studio, I just had a SimConnect.h file, a .lib file, and a .dll file, and I managed to make it work. Now I am trying to create a C++ widget project, using the same SDK, but in QT.
I put the header file in my QT project's folder, where the other default code and header files are located, and then I went to the project and added them as existing files, as I read in Google. I'm having problems with the actual library.
I've been searching Google for a guide on how to add a library file to the project, I did some things I saw on the internet, like the LIBS line for example, but I probably did it wrong, even though it looked very simple.
I am not sure where to drop my dll/library files in the project directory, maybe the problem is I always put them in the wrong spot.
The furthest I got to, was an error message saying "Unresolved external symbol", and a red writing saying ".obj file not found" on every function I tried to use from the SimConnect functions, which probably means QT couldn't find my library/dll file.
I also tried to add the libraries from the "Add library" option in the project, but that didn't work too.
EDIT: it also warns "warning: LNK4272: library machine type 'X86' conflicts with target machine type 'x64'" maybe it has to do something with it.
(Posted on behalf of the OP).
Solved! My problem was my machine was set to 64bit, while the library was set to 32bit, so I downloaded the 32bit kit, and ran the project through that, and it worked!

Sublime Text 2 - Changing the icon on Windows

As the title says, how do you change Sublime Text 2 default icon on Windows(7 or 8)?
I've searched everywhere. I found the post by Jeffrey Way on Nettuts that explains how to change it on the Mac and it was as simple as putting the 'nameoftheicon.icns' file somewhere in the default folder.
Now I have two problems:
1) I can't find the folder where the icns file should be put in
2) on Git(or somewhere else) when I find the repo of an icon the things to do in order to change it, even on the Mac, are way longer than Jeff's post
I wish the Windows folder was specified in that post to but it isn't(as you know he works on Mac).
So basically what's the fastest way to change the icon, maybe just by putting the icns files somewhere and avoiding the download of external software(as some Git repos suggests)?
There is no way of changing the icon on Windows without editing either the sublime_text.exe file or one of the libraries with an external program. It's just one of the many, many differences between Windows and Mac. .icns files are specific for the Mac platform, and don't exist in the Windows versions of Sublime Text.
There is no easy/fast method to change an application icon once its been compiled, however you can use a tool like Resource Tuner to alter the resources embedded within it.
Its worth noting that if you do use Resource Tuner it only supports 32bit binaries which means you will need to modify the 32bit version of Sublime. You can adjust the four icons defined there (16,32,48 256), you will need to create your own individual ICO files for each 32bit resource, import them using resource tuner and then save our .exe
An altered 32bit version of the .exe and .ico resources are here : https://copy.com/S7kKk6rh2Q3P12iu (nothing malicious however use at your own risk)
suggest https://github.com/dbmzzo/Sublime-Text-2-Icon
may help. BTW, it provide solution of changing icon in Win\Ubuntu\Mac

Lexical or Preprocessor issues Xcode when archiving

I was about to archive for the OTA distribution with Xcode 4 when Xcode is suddenly giving me the infamous preprocessor or lexical issue. This did not happen on the build nor release configuration settings both on the device and the simulator.
I used my own static library with the angle-bracket style import. Pardon me, but Im not quite sure wether that can cause the problems.
#import <MyCommonLib/headerfile.h>
On my static library project, I put all of the header on the public section and it is placed nicely on the DerrivedData shared folder for the build result (checked), and I have put the dependencies of my main project to depend on the static library project, also I have linked the static library with my main project.
Any idea of what can cause this only to happen when I am archiving it? (it tested great with both my device and simulator).
Cheers,
This error is due to some "imported" files no longer be found / referenced by compiler ( possibly "Deleted", either delete from disk / delete reference only).
Try to change:
#import<MyCommonLib/headerfile.h>
to:
#import "MyCommonLib/headerfile.h"
Make sure the file exist as well.

Qt: QWebview not displaying jpg, gif, png images on another machines

Today I came across a very strange error with QWebView which I cannot resolve myself.
I included a QWebView widget in my application. When I set a URL or a piece of HTML code to display (with QWebView::setUrl() or QWebView::setHtml()), it works very well on my machine. It also works on all machines that have Qt installed, but not on those without it. I compiled a release build and included all necessary libraries as shared (QtWebKit4.dll, QtNetwork4.dll etc.), so I guess my error lies in that I forgot to include some libraries.
If anybody has already had such an error, I would be very grateful for help!
You might need to include the relevant Qt image processing plugin libraries, which are located in qt/plugins/imageformats (and maybe also qt/plugins/iconengines ). I haven't deployed any webkit apps, so I'm not certain about this.
See my answer to this question: Qt dll deployment on windows

Resources