Usually, to add a QRC to your project you add a line like this:
qrcobj = programEnv.Qrc("SomeFile.qrc", QT4_QRCFLAGS="-name SomeFile")and all is well.
But - probably due to a bug somewhere in qt4.py module, the files that are referenced from inside the QRC (the actual images and stylesheets) are not added as a dependency to the build process, so when you change a CSS file, the QRC will not be rebuilt.
The snippet below parses the QRC manually, fetches the list of files inside and adds the to deps list; Python rocks.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#adding qrc resources compilation | |
import xml.dom.minidom | |
qtResourceFile = [] | |
for q in ("GUI.qrc", "UI/UI.qrc",): | |
baseq = os.path.basename(q)[:-4] | |
qrcdeps = [] | |
qrc = programEnv['ENV']['PWD'] + "/GUI/" + q | |
dir = os.path.dirname(qrc) | |
x = xml.dom.minidom.parse(open(qrc)) | |
for filenode in x.getElementsByTagName("file"): | |
qrcdeps += [ dir + "/" + filenode.childNodes[0].data ] | |
qrcobj = programEnv.Qrc(q, QT4_QRCFLAGS="-name "+baseq) | |
programEnv.Depends(qrcobj, qrcdeps) | |
qtResourceFile += [ qrcobj ] |
No comments:
Post a Comment