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

How to place cursor at the beginning of a cell of QTableWIdget



  • How to place cursor at the beginning of a cell of QTableWIdget without changing the cursor contents

    I am using following pyQt code

    def show(self, node = None, index = None, subWindow = None,
    width = None, height = None):
    if width and height:
    self.resize(width, height)
    self.parent.setTitle(self.titleText)
    self.reset(node, index, subWindow)
    self.table.update()
    super(self.class, self).show()
    if width and height:
    self.resize(width, height)
    print#("\n I am here in table widget")
    self.table.selectRow(0)
    #self.table.cellWidget(0,1).setFocusPolicy(0)
    self.table.cellWidget(0,1).setFocus()

    The line self.table.cellWidget(0,1).setFocus() displays cursor but it empties the text in cellWiget .

    My requirement is just set the Focus to cell widget of QtableWidget


  • Lifetime Qt Champion

    Hi,

    Why do you need a cell widget for ?



  • That is legacy code . What is way to do that


  • Lifetime Qt Champion

    That's not the answer to my question.

    Again: why is that code using cell widgets ? What for ?


Log in to reply