Copy/Paste with QTableView

  • Hi,

    I am using custom 2D model (inheriting from QAbstractTableModel) and QTableView sub-class to add some more features such as copy/paste support.

    Now consider this model in a view:

    x | 1 | 2 | 3
    1 | a | d | h
    2 | b | e | h
    3 | c | f | i

    Column 1 should be disabled for editing. It should allow copying the data but not pasting it, not even indirectly (i.e. you select 'h' and 'e' and paste it on 'd' => 'e' should not overwrite 'b').

    How to implement such a thing? Disabling editing on the model level seems wrong and it might even hinder things like populating model with data. However on the view level I have no knowledge of the proportions of the incoming MIME data.

    Maybe I am going about it all wrong though. Any suggestiong would be appreciated.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.