Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 6

Qt-interest Archive, July 2007
Re: Model changed view not updated


Message 1 in thread

Hi Manuel this is explained in QAbstractTableModel doc

http://doc.trolltech.com/4.3/qabstracttablemodel.html#details

i paste here the relevant section

    * An insertRows() implementation must call beginInsertRows()
before inserting new rows into the data structure, and it must call
endInsertRows() immediately afterwards.
    * An insertColumns() implementation must call beginInsertColumns()
before inserting new columns into the data structure, and it must call
endInsertColumns() immediately afterwards.
    * A removeRows() implementation must call beginRemoveRows() before
the rows are removed from the data structure, and it must call
endRemoveRows() immediately afterwards.
    * A removeColumns() implementation must call beginRemoveColumns()
before the columns are removed from the data structure, and it must
call endRemoveColumns() immediately afterwards.

BTW  you can ceate a Sql View with the data you whant display and Use
QSqlTableModel
On 5/23/07, Manuel Schmidt <manuel@xxxxxxxxxxxxx> wrote:
> Hello list,
> i have a Model derived from QAbstractTableModel. In it is a QSqlDatabse
> Member. I know there is a QSqlTableModel but i dont want to use it since the
> Columns in the View are not the same Columns of the Sql Database. Actually
> the Columns in the View/Model are fixed (5).
>
> My Model now Implements rowCount() using a select on the QSqlDatabase Member.
> I olso have a setFilter() function which should work as the setFilter from
> QSqlTableModel. The rowCount respects the filter returning the correct number
> of rows.
>
> My Problem now is, the View does not get noticed about the changed rows. Where
> would i emit layoutChanged()? I have emit'ed it in my setFilter Function, but
> without success. Do i have to connect the layoutChanged() with the view
> manualy? Or do i have to emit it somewhere else? The View is a standard
> QTableView.
>
> --
> Thank you
> Manuel
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>


-- 
 [ signature omitted ]