Solved QImage doesn't take in a JPG
-
@Rapidrain Sorry, again forgot that you're on Windows:
set QT_DEBUG_PLUGINS=1 ./my_app
-
@jsulm said in QImage doesn't take in a JPG:
QT_DEBUG_PLUGINS=1
guess what?
It doesn't help.
Can you suggest a chain of options I must add to g++ when compiling and linking this code? -
@Rapidrain said in QImage doesn't take in a JPG:
Can you suggest a chain of options I must add to g++ when compiling and linking this code?
As I said before: there is no need to add any options to compiler/linker. The plug-ins are automatically loaded at runtime when needed. You either have some issues with your JPEG plug-in or with the picture you're trying to display. See http://doc.qt.io/qt-5/debug.html
After setting QT_DEBUG_PLUGINS your app should actually output a lot of text. Do you test a debug build? -
@jsulm , What exactly do you mean "do you test a debug build" ???
-
@Rapidrain Did you build your app in debug or release mode?
-
@Rapidrain After setting QT_DEBUG_PLUGINS your app should actually output a lot of text. Do you test a debug build?
the statement "set QT_DEBUG_PLUGINS=1" is not a communication with my app. It is a communication with the Windows Operating System. Why should my app output a "lot of text" ?? It hasn't even started yet.
-
@jsulm I am building it at the moment in Debug mode
-
@Rapidrain said in QImage doesn't take in a JPG:
It is a communication with the Windows Operating System
wrong, it just sets an environment variable - Windows does not care about it at all. Qt checks this variable at runtime and if it is set it prints debug output while loading plug-ins. That's how environment variable work.
You can see which variables are set executing "set" command on Windows.
-
@jsulm so when I set a windows environment variable to a value, I am not communicating with the Windows OS in any way??
-
@Rapidrain It depends on what you mean if you say "Windows OS"? Do you mean Windows NT kernel? Then no, you do not communicate with it. If you consider the shell as part of the OS then you are interacting with the OS, but not communicating as the OS does not care about variables you set - it just sets a variable to a value that's it.
-
Hi,
From the image you posted, your jpeg plugin files are not located in the correct sub-folder.
-
Any external image should be allocated in Resources.
Please create a resource file in your project. In the resource view... add a prefix "/", and then insert your image.
In your code, use something like the example below, rather that the absolute path.
m_pBackButton->setIcon(QIcon(":/Resources/cancelButton.jpg"));
Thank you.
-
It's working with jpegs now. I had reference to a non-existant directory in the link statement.
Sorry Charlie, but doing it with this resources dance makes it all too complicated. Doing baby steps here.
Maybe later.It wasn't the jpeg plugins.