I've been reading around online and have not found a solution yet. What i want to do is either change the color of the icon per use, or change the opacity of it.
So if someone could help, how can i change the color of the SVG icon 'Vimeo' to be red or blue rather than creating multiple images?
Link to svg: https://www.dropbox.com/s/vshvosnuu5998wy/vimeo.svg?dl=0
# Modules
# ------------------------------------------------------------------------------
import sys
from PySide import QtGui, QtCore, QtSvg
# widget
# ------------------------------------------------------------------------------
class Example(QtGui.QWidget):
def __init__(self,):
super(Example, self).__init__()
self.initUI()
def initUI(self):
# formatting
self.setGeometry(300, 300, 600, 300)
self.setWindowTitle("Example")
# widgets
self.itemList = QtGui.QTreeWidget()
self.itemList.setItemsExpandable(True)
self.itemList.setAnimated(True)
self.itemList.setItemsExpandable(True)
self.itemList.setColumnCount(2)
self.itemList.setHeaderLabels(['', ''])
# load some icons
self._ico_01 = QtGui.QIcon('vimeo.svg')
# add items
item0 = QtGui.QTreeWidgetItem(self.itemList, ['testing', ''])
item0.setIcon(1, self._ico_01) # 1 - we set image for second colomn
item1 = QtGui.QTreeWidgetItem(self.itemList, ['testing', ''])
item1.setIcon(1, self._ico_01) # 1 - we set image for second colomn
# layout
self.mainLayout = QtGui.QGridLayout(self)
self.mainLayout.addWidget(self.itemList)
self.show()
# Main
# ------------------------------------------------------------------------------
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())