col = self.columnAt( pos.x() )
row = self.rowAt( pos.y() )
if 0<= col < self.model().columnCount() and 0<= row < self.model().rowCount():
menu = QMenu(parent=self)
editSharedPropertiesAction = QAction( "Edit shared properties...", menu )
editPropertiesAction = QAction( "Edit properties...", menu )
After Change
row = self.rowAt( pos.y() )
if 0 <= col < self.model().columnCount() and \
0 <= row < self.model().rowCount() - 1: // last row is a button
menu = QMenu(parent=self)
editSharedPropertiesAction = QAction( "Edit shared properties...", menu )
editPropertiesAction = QAction( "Edit properties...", menu )