Qt Centre Forum FAQ

Here you can find answers to questions about how the board works. Use the links or search box below to find your way around.

Why the images are not visible when I move the application to another place (directory, machine) or start it by double-clicking its icon?

You are probably using relative paths to your images such as:

QPixmap("icons/fileopen.png");
If you move your application or start with a different working directory but leave the images where they were the relative path to them will have changed and your program won't be able to open the file containing the image because the path is incorrect.

To solve this case use one of the following (in order from best solution to least good one):

  1. Embed the images directly into your application using Qt Resource System
  2. Use QCoreApplication::applicationDirPath() that points to the directory containing the application:
    QPixmap(QCoreApplication::applicationDirPath()+"/icons/fileopen.png");
  3. Use absolute paths to the images and store them in a well known place such as /usr/share/apps/myappname or one of QDesktopServices::StandardLocation

Why no images are displayed when I deploy my application on another machine that doesn't have Qt installed even though they are displayed on my computer?

You probably didn't deploy image plugins with your application. You need to copy the contents of plugins/imageformats directory of your Qt installation to the imageformats subdirectory of the directory where you deployed the application binary.

For instance if you deployed the application to C:\Program Files\MyApp, you need to copy the plugins to C:\Program Files\MyApp\imageformats.

Imageformat plugins are libraries called "qjpeg", "qsvg", "qtiff", etc.

Search FAQ

Select this option if you would like your search to look in the text of FAQ items as well as their titles.

Select an option here to specify how you would like your search query to be treated. 'Any words' will return the most numerous but possibly least relevant results, while 'Complete phrase' will return only results that contain exactly what you are searching for.

Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.