Qt 6.7.0: QTableWidget.itemAt() always returns first QTableWidgetItem passed to setItem
Solved
General and Desktop
-
The following test case fails qith PyQt-6.6.1 and Qt-6.7.0:
def test_QTableWidget_ids(qtbot): item_0 = QTableWidgetItem() item_1 = QTableWidgetItem() item_2 = QTableWidgetItem() w = QTableWidget(3, 3) w.setItem(0, 0, item_0) w.setItem(1, 0, item_1) w.setItem(2, 0, item_2) assert id(w.itemAt(0, 0)) != id(w.itemAt(1, 0)) assert id(w.itemAt(1, 0)) != id(w.itemAt(2, 0))
QTableWidget.itemAt
returns the firstQTableWidgetItem
passed toQTableWidget.setItem
regardless of coordinates passed to either method and regardless of number of calls tosetItem
with differentQTableWidgetItem
's. What gives?? is this some new functionality in Qt 6 that requires a different setting? Or a bug in PyQt6 maybe? -
I figured it out. I was calling
itemAt()
instead ofitem()
. Been correctly making that call for 20 years. Friday brain wins again :) -
S SGaist has marked this topic as solved on
-
Don't feel bad. That one's been tripping people up for at least 14 years now.