Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, May 2008
Paths in Windows and QPixmap


Message 1 in thread

I have a function which takes a path to an image as a QString, loads it into
a QPixmap, and then (if QPixmap::isNull () is false), displays the QPixmap
in a QLabel.  This worked fine while I was testing it in Linux, giving it
paths like "/home/username/subfolder/test.jpg", but when I moved it over to
Windows and started giving it paths like "C:\subfolder\test.jpg" it
doesn't.  I've tried turning the backslashes into forward slashes, getting
rid of the C:, getting rid of the first backslash, and various combinations
of the above, but nothing seems to work.  Does anyone know what format of
Windows paths QPixmap wants to see?

Message 2 in thread

First, the documentation specifically states that you must use forward
slashes. (But you tried this.)

Second, make sure that you have access to the JPEG imageformat plug-in at
runtime. Do any other JPEGs load?

Keith
**Please do not reply to me, reply to the list.**


On 05-19-2008 11:45 AM, "Ellen Kestrel" wrote:

> I have a function which takes a path to an image as a QString, loads it into a
> QPixmap, and then (if QPixmap::isNull () is false), displays the QPixmap in a
> QLabel.  This worked fine while I was testing it in Linux, giving it paths
> like "/home/username/subfolder/test.jpg", but when I moved it over to Windows
> and started giving it paths like "C:\subfolder\test.jpg" it doesn't.  I've
> tried turning the backslashes into forward slashes, getting rid of the C:,
> getting rid of the first backslash, and various combinations of the above, but
> nothing seems to work.  Does anyone know what format of Windows paths QPixmap
> wants to see?
> 



Message 3 in thread

Ahh, I think the plugin may be the problem - I have Qt built staticly on
Windows.  I seem to recall something in the deploment howto about including
plugins - I didn't realize I had to have one to load images.  Thanks.

On Mon, May 19, 2008 at 9:54 AM, Keith Esau <keith.esau@xxxxxxx> wrote:

>  First, the documentation specifically states that you must use forward
> slashes. (But you tried this.)
>
> Second, make sure that you have access to the JPEG imageformat plug-in at
> runtime. Do any other JPEGs load?
>
> Keith
> **Please do not reply to me, reply to the list.**
>
>
> On 05-19-2008 11:45 AM, "Ellen Kestrel" wrote:
>
> I have a function which takes a path to an image as a QString, loads it
> into a QPixmap, and then (if QPixmap::isNull () is false), displays the
> QPixmap in a QLabel.  This worked fine while I was testing it in Linux,
> giving it paths like "/home/username/subfolder/test.jpg", but when I moved
> it over to Windows and started giving it paths like "C:\subfolder\test.jpg"
> it doesn't.  I've tried turning the backslashes into forward slashes,
> getting rid of the C:, getting rid of the first backslash, and various
> combinations of the above, but nothing seems to work.  Does anyone know what
> format of Windows paths QPixmap wants to see?
>
>
>

Message 4 in thread

Ok, I'm confused.  I tried to link staticly against the plugins as described
in the documentation, by including <QPlugin> into main.cpp and adding in
Q_IMPORT_PLUGIN (qjpeg), etc, but now the program won't compile.  MinGW
says:

./release\main.o(.text+0x41c):main.cpp: undefined reference to
'qt_plugin_instance_qjpep()'

What am I doing wrong?

On Mon, May 19, 2008 at 10:03 AM, Ellen Kestrel <dragonflykes@xxxxxxxxx>
wrote:

> Ahh, I think the plugin may be the problem - I have Qt built staticly on
> Windows.  I seem to recall something in the deploment howto about including
> plugins - I didn't realize I had to have one to load images.  Thanks.
>
>
> On Mon, May 19, 2008 at 9:54 AM, Keith Esau <keith.esau@xxxxxxx> wrote:
>
>>  First, the documentation specifically states that you must use forward
>> slashes. (But you tried this.)
>>
>> Second, make sure that you have access to the JPEG imageformat plug-in at
>> runtime. Do any other JPEGs load?
>>
>> Keith
>> **Please do not reply to me, reply to the list.**
>>
>>
>> On 05-19-2008 11:45 AM, "Ellen Kestrel" wrote:
>>
>> I have a function which takes a path to an image as a QString, loads it
>> into a QPixmap, and then (if QPixmap::isNull () is false), displays the
>> QPixmap in a QLabel.  This worked fine while I was testing it in Linux,
>> giving it paths like "/home/username/subfolder/test.jpg", but when I moved
>> it over to Windows and started giving it paths like "C:\subfolder\test.jpg"
>> it doesn't.  I've tried turning the backslashes into forward slashes,
>> getting rid of the C:, getting rid of the first backslash, and various
>> combinations of the above, but nothing seems to work.  Does anyone know what
>> format of Windows paths QPixmap wants to see?
>>
>>
>>
>

Message 5 in thread

Ellen Kestrel schrieb:
> Ok, I'm confused.  I tried to link staticly against the plugins as described
> in the documentation, by including <QPlugin> into main.cpp and adding in
> Q_IMPORT_PLUGIN (qjpeg), etc, but now the program won't compile.  MinGW
> says:
> 
> ./release\main.o(.text+0x41c):main.cpp: undefined reference to
> 'qt_plugin_instance_qjpep()'
> 
> What am I doing wrong?
> 
You should also actually *link* against the jpeg plugin :)


Christian

--
 [ signature omitted ] 

Message 6 in thread

Right.  I did add the lines to the .pro file, but forgot to rerun qmake.
Unfortunately, the image still isn't showing up - QPixmap::isNull () is
false, but the image doesn't appear.  Is there something else I have to do?

On Mon, May 19, 2008 at 11:07 AM, Christian Ehrlicher <Ch.Ehrlicher@xxxxxx>
wrote:

> Ellen Kestrel schrieb:
>
>> Ok, I'm confused.  I tried to link staticly against the plugins as
>> described
>> in the documentation, by including <QPlugin> into main.cpp and adding in
>> Q_IMPORT_PLUGIN (qjpeg), etc, but now the program won't compile.  MinGW
>> says:
>>
>> ./release\main.o(.text+0x41c):main.cpp: undefined reference to
>> 'qt_plugin_instance_qjpep()'
>>
>> What am I doing wrong?
>>
>>  You should also actually *link* against the jpeg plugin :)
>
>
> Christian
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>