PDA

View Full Version : Action Icons not showing when running app



jimmydean101
28th February 2010, 21:56
Hello,

I'm pretty new to Qt and C++ so please let me know if I am not asking the right questions or if this isn't the correct place to post this.

I am currently running Qt Creator 1.3.1 / Qt 4.6.1 (32 bit) on Windows XP. The issue I am experiencing is when in Qt Designer I create new action in the action editor I can see the icon that I have associated with the action, I can move the action to the action tool bar and see the icon, but when I run the app the icon does not show. This also happens foraction icons in the menu bar. When I roll over the area where the icon is supposed to be there is a clickable space visable where the icon should be. In the property explorer under QAction/icon I've added the same icon to Normal Off, Normal On, and Active On but it doesn't show.

Any ideas?

Lykurg
28th February 2010, 22:22
Did you use relative path to your icons? They differ when running your applications because then the starting point of relative paths are the directory containing the exe. Try to use Qt resource system.

jimmydean101
28th February 2010, 22:42
Hey Lykurg,

I'm learning a lot here today. I am trying to do everything through the Designer that I can. I had assumed that when I selected a particular file for the icon that a .qrc file was going to be created and that RESOURCES was going to be added automatically to the .pro file. I went and created a new .qrc file and added the file folder with all the images files. I'm now selecting the files from the resource and it's working now.

Thanks

aborigen2305
17th May 2010, 10:25
You need to use qt plugin qico:
1. add in .pro
"....
CONFIG += staticlib
QTPLUGIN += qico"

2. add in .h (mainwindow.h)
"
.....
#include <QtCore/QtPlugin>

Q_IMPORT_PLUGIN(qico);
"
3. copy files <QT Dir>/plugins/imageformats/libqico*.a to <QT Dir>/lib

P.S. I'm use QT with static

core_st
14th February 2011, 15:35
have the same problem. How to correct this trouble? When i start app all icons from buttons disappear. But in editor i see them. My *.pro file


QT += phonon \
multimedia
TARGET = CorePlayer
TEMPLATE = app
DESTDIR = ../Qplayer/bin
SOURCES += src/main.cpp \
src/mainwindow.cpp \
src/widesearch.cpp
HEADERS += src/mainwindow.h \
src/widesearch.h
FORMS += src/mainwindow.ui \
src/tageditor.ui
RESOURCES += images/coreplayer.qrc




win32 {
INCLUDEPATH += src/taglib-1.6.3-mingw-bin/include \
INCLUDEPATH += src/flac-1.2.1-devel-win/include \

LIBS += ../Qplayer/src/taglib-1.6.3-mingw-bin/lib/libtag.dll.a
LIBS += ../Qplayer/src/flac-1.2.1-devel-win/lib/libFLAC.lib

}

OTHER_FILES +=

OBJECTS_DIR = $${DESTDIR}/obj
MOC_DIR = $${DESTDIR}/obj
RCC_DIR = $${DESTDIR}/obj
UI_DIR = ./src/