Hello PyQt,<div><br></div><div>I'm wondering why I can't change the text that's displayed in the horizontal or vertical header of my standard QTableWidget.</div><div><br></div><div>- Constructor and simple count specification</div>
<div><div><br></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
<a href="http://self.tw">self.tw</a> = QtGui.QTableWidget() </blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
self.tw.setColumnCount(5)</blockquote><div><div><br></div></div></div><div><br></div><div>- Attempt 1:</div><div> </div><div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
self.tw.setHorizontalHeaderLabels(("a", "b", "c", "d", "e")) # Doesn't work, the default "1" ... "5" are still shown</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
self.tw.setHorizontalHeaderItem(1, QtGui.QTableWidgetItem("b")) # Doesn't work, the header label isn't updated to "b"</blockquote><div><br></div><div><br></div><div>- Attempt 2:</div><div><br></div>
<blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
twi = QtGui.QTableWidgetItem("b")</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
self.tw.setHorizontalHeaderItem(1, twi)</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
self.tw.horizontalHeader().setVisible(True) # Nope, this doesn't work either</blockquote><div><br></div><div><div><br></div><div>- Attempt 3:</div><div><br></div><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
twi = QtGui.QTableWidgetItem()</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
self.tw.setHorizontalHeaderItem(1, twi)</blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
self.tw.horizontalHeader().setVisible(True) # Nope, this doesn't work either </blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
_twi = self.tw.horizontalHeaderItem(1) </blockquote><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">
_twi.setText("b") # Nope, doesn't get updated by this either..</blockquote><div> </div></div><div><br></div></div><div>What am I doing wrong? How much more combinations of horizontalHeader-stuff do I have to try in order to do this simple thing?</div>
<div><br></div><div><br></div><div>-- <br>Nick Gaens<br>
</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div>