Finally, I found the reason. I had to add -Wl,-rpath,$(ROOTSYS)/lib to the end of the LIBS definition. So the solution is the following:
Add ROOTSYS to the Projects/Build Environment
Add -Wl,-rpath,$(ROOTSYS)/lib to the libs.
The .pro file looks like this:
TEMPLATE = app
win32 {
QMAKE_CXXFLAGS += -FIw32pragma.h
}
CONFIG += qt warn_on thread
INCLUDEPATH += $(ROOTSYS)/include
win32:LIBS += -L$(ROOTSYS)/lib -llibCore -llibCint -llibRIO -llibNet \
-llibHist -llibGraf -llibGraf3d -llibGpad -llibTree \
-llibRint -llibPostscript -llibMatrix -llibPhysics \
-llibGui -llibRGL
else:LIBS += -L$(ROOTSYS)/lib -lCore -lCint -lRIO -lNet \
-lHist -lGraf -lGraf3d -lGpad -lTree \
-lRint -lPostscript -lMatrix -lPhysics \
-lGui -lRGL -Wl,-rpath,$(ROOTSYS)/lib
HEADERS += canvas.h
SOURCES += canvas.cxx main.cxx