<html>
<body>
Dear all,<br><br>
i'm writing a plugin form to set the color of different object of the
same layer.<br>
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.<br>
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.<br><br>
<font face="Courier New, Courier">&nbsp;&nbsp;&nbsp;&nbsp; Colors =
[QColor(</font><font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">,</font>
<font face="Courier New, Courier" color="#800000">255</font>
<font face="Courier New, Courier">,</font>
<font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">),QColor(</font>
<font face="Courier New, Courier" color="#800000">255</font>
<font face="Courier New, Courier">,</font>
<font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">,</font>
<font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">),QColor(</font>
<font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">,</font>
<font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">,</font>
<font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">)]<br>
&nbsp;&nbsp;&nbsp;&nbsp; <i>self</i>.lstColorBoat.clear()<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<i>self</i>.lstColorBoat.setRowCount(len(Colors))<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<i>self</i>.lstColorBoat.setColumnCount(</font>
<font face="Courier New, Courier" color="#800000">2</font>
<font face="Courier New, Courier">)<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<i>self</i>.lstColorBoat.setHorizontalHeaderLabels([</font>
<font face="Courier New, Courier" color="#00AA00"><i>&quot;Boat&quot;</i>
</font><font face="Courier New, Courier">,
</font><font face="Courier New, Courier" color="#00AA00"><i>
&quot;Color&quot;</i></font><font face="Courier New, Courier">])<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<i>self</i>
.lstColorBoat.setSelectionMode(QTableWidget.SingleSelection)<br>
&nbsp;&nbsp;&nbsp;&nbsp;
<i>self</i>.lstColorBoat.setSelectionBehavior(QTableWidget.SelectRows)<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;
</font><font face="Courier New, Courier" color="#0000FF">for</font>
<font face="Courier New, Courier"> i, ItmColor
</font><font face="Courier New, Courier" color="#0000FF">in</font>
<font face="Courier New, Courier"> enumerate(Colors):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; item =
QTableWidgetItem(</font><font face="Courier New, Courier" color="#00AA00">
<i>&quot;KitICT&quot; </i></font><font face="Courier New, Courier">+
str(i))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>self</i>.lstColorBoat.setItem(i,
</font><font face="Courier New, Courier" color="#800000">0</font>
<font face="Courier New, Courier">, item)<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; item =
QTableWidgetItem(ItmColor[0])<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<i>self</i>.lstColorBoat.setItem(i,
</font><font face="Courier New, Courier" color="#800000">1</font>
<font face="Courier New, Courier">, item)<br>
&nbsp;&nbsp;&nbsp;&nbsp;
</font><font face="Courier New, Courier" color="#0000FF">pass<br><br>
</font>May someone help me?<br><br>
Thank you, Michele.<br><br>
<br>
</body>
</html>