Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Does tab order in a QTableWidget ignore setCurrentCell()? ...why? ...work around?



  • I have a QTableWidget where, in my itemChanged slot function, I relocate the user back to a certain cell if they entered something bad / invalid / custom validation. I do this using table.setCurrentCell(row, errCol). This only seems to work if the user enters the data by pressing the return key. Yet, if they tab out of the cell, regardless of the fact that the itemChanged function was correctly called with the correct row and col params, my setCurrentCell() is completely ignore and the tab send the user to the next tab order cell no matter what. Is there a way for me to catch this, set them back to their invalid entered cell?

    Thank you!


  • Lifetime Qt Champion

    Hi,

    Interesting use case. Can you provide a minimal sample that shows that behavior ?

    By the way, what version of Qt ? On what OS ?



  • @SGaist I will put together an example. In the mean time, my versions:

    Qt version: 5.9.4
    SIP version: 4.19.8
    PyQt version: 5.9.2

    OS: Windows 10


Log in to reply