deepak deepak - 3 months ago 14
C++ Question

setData() versus insertRows() Qt ModelView

In Qt model-view how is

setData
different than
insertRows
. I understand that
insertRows
is just for new rows addition, whereas
setData
can modify existing data as well. Can
setData
also be used to insert additional rows in a table or list based model. I am new to Qt, so please pardon if the question is too basic.

Answer

No, setData() is to be used to change existing data, or more precisely to manipulate data for an index that exists. You cannot add rows using this method.