[Qgis-developer] Problem with Color
Michele Mammini
mamminim at yahoo.it
Tue Jan 19 06:27:44 EST 2010
Dear all,
i'm writing a plugin form to set the color of different object of the
same layer.
i'd like to realize something like the Color map in the Raster Layer
properties: a table where each entry is an object and for each object
the user can set a color through QColorDialog.getColor() function.
I tried to realize the form using the QTableWidget object but an
error occurred (TypeError: 'QColor' object is unindexable) when i
tried to read the color.
Colors = [QColor(0,255,0),QColor(255,0,0),QColor(0,0,0)]
self.lstColorBoat.clear()
self.lstColorBoat.setRowCount(len(Colors))
self.lstColorBoat.setColumnCount(2)
self.lstColorBoat.setHorizontalHeaderLabels(["Boat", "Color"])
self.lstColorBoat.setSelectionMode(QTableWidget.SingleSelection)
self.lstColorBoat.setSelectionBehavior(QTableWidget.SelectRows)
for i, ItmColor in enumerate(Colors):
item = QTableWidgetItem("KitICT" + str(i))
self.lstColorBoat.setItem(i, 0, item)
item = QTableWidgetItem(ItmColor[0])
self.lstColorBoat.setItem(i, 1, item)
pass
May someone help me?
Thank you, Michele.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20100119/30125226/attachment.html
More information about the Qgis-developer
mailing list