Important: Please read the Qt Code of Conduct -

Changing look of persistent editors in QTableView

  • Hello,

    I am trying to build a QTableView with editors that are visible for all fields even when they haven't been clicked yet. To that end I've used the method openPersistentEditors(). This gave me nearly all I needed. My only problem is that the editors for QString, i.e. QLineEdit all display the text "cursor". By text cursor I refer to the normal vertical bar that marks the end of the currently edited text.

    As I have a couple of these QLineEditS in different cells, this doesn't look correct. When clicking in these editors one by one the text cursor disappears, but I hope there's a programmatic way to achieve the same effect.

    I've read that you can also use setIndexWidget() to get "persistent" editors, but I want to recover the changed data and I'd rather not rewire the widget's slots directly myself with the model, which seems complicated to me. Moreover I have a couple of different types and I'd rather not determine the correct widgets for the correct type myself, each time.

    I'm using Qt 4.6.2 on a Windows 7 machine.


Log in to reply