[SOLVED] QSystemTrayIcon icon from resource file isn't showing
-
That sounds like a build issue. Try making sure your build environment is totally clean and rebuild. Check out a fresh copy from source control even. Or at a bare minimum
make distclean
thenmake
.See if that resolves your icon issues.
I'll still play with your code in a bit, just haven't had time yet.
-
You're right, it's a build issue.
Rebuilding it produced many errors it did not complain about before, meaning that all of the last time I clicked the run button did not really compile my changed code and I kept checking the same thing.
Now it's stuck on
qtmaind.lib(qtmain_win.obj):-1: error: LNK2019: unresolved external symbol _main referenced in function _WinMain@16
No matter what I do, I tried running qmake, cleaning all and rebuilding all but nothing seems to make it want to recompile my changed code.
There's nothing to check out, it's a completely new project with the minimum of code I posted. -
Ok then this is probably not an icon issue with systray. In fact one of the suggestions above probably fixed it but we never knew because of the build issues.
So moving on to the build issues:
- Can you show me your *.pro file?
- What OS are you using?
- What IDE are you using since you said "clicked run" before I'm assuming you aren't using the command line. :)
- What compiler are you using?
-
Yes, you are correct again.
I created a new project and copied just the icon related code and the icon does appear now in the tray.As for the build issue:
I'm developing on windows 8.1, using the Qt Creator (as I can't seem to find an addin to visual studio 2013 (I found this: http://download.qt.io/official_releases/vsaddin/qt-vs-addin-1.2.4-opensource.exe.mirrorlist but it won't run on my machine).
But it uses the VS2013 compiler.Here's my .pro file:
TEMPLATE = app QT += qml quick widgets HEADERS += source/*.h SOURCES += source/*.cpp RESOURCES += qml.qrc \ images.qrc # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = # Default rules for deployment. include(deployment.pri) DISTFILES += \ images/appicon.png #win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32/release/ -llibcef #else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32/debug/ -llibcef #INCLUDEPATH += $$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32 #DEPENDPATH += $$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32 #win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32/release/liblibcef.a #else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32/debug/liblibcef.a #else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32/release/libcef.lib #else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/../../CEF/cef_binary_3.2357.1280.geba024d_windows32/debug/libcef.lib
As can be seen, I added a library (chromium embedded framework) but after reading about how that error is caused when adding additional libs I commented it out, but still that error would not go away.
It's probably something to do with the Qt Creator which caches things? -
Ok, I finally managed to get everything working!
What I did was to set the
Default build directory
to.
instead of what it has there, and I unchecked theUse jom instead of nmake
box.
Now it seems to actually rebuilding the up to date code.Thanks for all the help!
-
Good, glad ya got it sorted out. Sorry I've been super busy lately and haven't lurked the forums here. :)