Results 1 to 3 of 3

Thread: problem with resources

  1. #1
    Join Date
    Jan 2007
    Posts
    7
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Default problem with resources

    Hi,
    I have a problem with resources. I want to use a image as icon as WindowIcon
    and SystemTrayIcon.
    For this I created a .qrc fle:

    Qt Code:
    1. <!DOCTYPE RCC><RCC version="1.0">
    2. <qresource >
    3. <file>web_logo.jpg</file>
    4. </qresource>
    5. </RCC>
    To copy to clipboard, switch view to plain text mode 

    and I make the statment in my .pro file:

    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. QT += network
    6. # Input
    7. #FORMS += GAB_tool.ui
    8. RESOURCES += gabtool.qrc
    9. SOURCES += main.cpp
    10. HEADERS +=ui_GAB_tool.h
    To copy to clipboard, switch view to plain text mode 

    I use the Q_INIT_RESOURCE function for the .qrc file in my main function.

    Then I use the source in this way:

    Qt Code:
    1. .....
    2. MainWindow->setWindowIcon(QIcon(QString::fromUtf8(":/web_logo.jpg")));
    3. ....
    4. trayicon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/web_logo.jpg")));
    5. trayicon->show();
    6. ......
    To copy to clipboard, switch view to plain text mode 
    The problem is, only on my system the icons are showed. On other systems the icons
    are not showed. The other systems are Windows 2000 and XP. In case of the SystemTrayIcon the space for the icon is created and the actions also work. (right click menue and so on) Only the icon itself is not.
    On systems where the complete Qt instalation for development is installed it works !
    Has someone an idea what's wrong.
    Greetings,
    SuperSonik

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem with resources

    I think the problem is with loading jpeg images.
    Qt doesnt have direct support for them,,, while deploying you have to ship the plugins too.

    For this copy the \Qt\4.2.0\plugins\imageformats folder along with ur application. Say u installed ur exe on C:\test , copy imageformats folder also to C:\test
    See more for deploying Qt Applications

    Hope this works..

  3. The following 2 users say thank you to aamer4yu for this useful post:

    brent99 (10th March 2008), SuperSonik (15th February 2007)

  4. #3
    Join Date
    Jan 2007
    Posts
    7
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Default Re: problem with resources

    Quote Originally Posted by aamer4yu View Post
    I think the problem is with loading jpeg images.
    Qt doesnt have direct support for them,,, while deploying you have to ship the plugins too.

    For this copy the \Qt\4.2.0\plugins\imageformats folder along with ur application. Say u installed ur exe on C:\test , copy imageformats folder also to C:\test
    See more for deploying Qt Applications

    Hope this works..
    Thanks,
    that was the hint I need!
    Greetings,
    SuperSonik

Similar Threads

  1. QTimer problem ... it runs but never triggs
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 4th July 2006, 12:54
  2. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  3. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  4. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.