Qt-interest Archive, July 2007
QTreeView refresh
Message 1 in thread
I have a QTreeView with a model derived from a QAbstractItemModel.
I insert a new element in the QTreeView and I need to refresh the tree.
I try with update(), repaint() or to emit the dataChanged() SIGNAL, but
it don't runs.
Suggestions?
Thanks
Teo
--
[ signature omitted ]
Message 2 in thread
On 7/2/07, Vincenzo Ferraro <vincenzo.ferraro@xxxxxxxxx> wrote:
>
> I have a QTreeView with a model derived from a QAbstractItemModel.
> I insert a new element in the QTreeView and I need to refresh the tree.
> I try with update(), repaint() or to emit the dataChanged() SIGNAL, but
> it don't runs.
You emitted rowsAboutToBeInserted() and rowsInserted() at the correct times,
right?
Tom
Message 3 in thread
I have a QTreeView with a model derived from a QAbstractItemModel.
I insert a new element in the QTreeView and I need to refresh the tree.
I try with update(), repaint() or to emit the dataChanged() SIGNAL, but
it don't runs.
Suggestions?
Thanks
Teo
--
[ signature omitted ]
Message 4 in thread
> I have a QTreeView with a model derived from a QAbstractItemModel.
> I insert a new element in the QTreeView and I need to refresh the tree.
> I try with update(), repaint() or to emit the dataChanged() SIGNAL, but
> it don't runs.
> Suggestions?
Did you emit
void rowsAboutToBeInserted ( const QModelIndex & parent, int start, int
end )
void rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int end
)
when inserting new rows?
Regards,
Malte
--
[ signature omitted ]
Message 5 in thread
Erm,
> void rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int
end
> )
Of course I ment
void rowsInserted ( const QModelIndex & parent, int start, int end )
for the second signal.
Copy-n-Paste is a very difficult task for me ;-)
Malte
--
[ signature omitted ]
Message 6 in thread
I try but rowsInserted and rowsAboutToBeRemoved are private. In effect
the class QAbstractItemModel
class QAbstractItemModel...
...
#if !defined(MOC_) && !defined(qdoc)
private: // can only be emitted by QAbstractItemModel
#endif
void rowsAboutToBeInserted(const QModelIndex &parent, int first,
int last);
void rowsInserted(const QModelIndex &parent, int first, int last);
void rowsAboutToBeRemoved(const QModelIndex &parent, int first, int
last);
void rowsRemoved(const QModelIndex &parent, int first, int last);
void columnsAboutToBeInserted(const QModelIndex &parent, int first,
int last);
void columnsInserted(const QModelIndex &parent, int first, int last);
void columnsAboutToBeRemoved(const QModelIndex &parent, int first, ...
and I can't define MOC_ or qdoc.
So I can't call rowsInserted and rowsAboutToBeRemoved.
Thanks
Teo
Malte Witt wrote:
> Erm,
>
>
>>void rowsAboutToBeRemoved ( const QModelIndex & parent, int start, int
>
> end
>
>>)
>
>
> Of course I ment
>
> void rowsInserted ( const QModelIndex & parent, int start, int end )
>
> for the second signal.
>
> Copy-n-Paste is a very difficult task for me ;-)
>
> Malte
>
> --
> 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 ]
Message 7 in thread
> I try but rowsInserted and rowsAboutToBeRemoved are private. In effect
> the class QAbstractItemModel
Ooops, I am terribly sorry (didn't have my morning-coffe yet when writing
my first post).
Of course you have to call
beginInsertRows ( const QModelIndex & parent, int first, int last )
and corresponding
endInsertRows ()
which in turn will emit the mentioned signals for you :-)
Sorry - that was my fault.
Regards,
Malte
--
[ signature omitted ]