Reimplement currentChanged and selectionChanged problems ??
I want to know when the user change the current cell, and when the selection change So I use currentChanged and selectionchanged reimplemented for my custom tableview.
Ok, I dont know what is the problem but If I do click on a cell I need to wait almost a second to view the current cell selected......
(And I have comment the possible code asociated to each slot)
Any Idea ?
Re: Reimplement currentChanged and selectionChanged problems ??
Quote:
Originally Posted by
tonnot
Any Idea ?
If you were to provide us with some code, it would probably help us to help you... Have you checked the original implementation of those methods to make sure that you are not missing something that is critical? Also, if you might not want to call QTableView::currentChanged, you might still want to call QAbstractItemView::currentChanged...?
Re: Reimplement currentChanged and selectionChanged problems ??
I only have this code (without any other commands inside them :
And as public slots :
A_table is a custom widget extending QTableView and it is connected to a custom model extending QAbstractTableModel(parent)
All works fine except this issue.
Thanks
Re: Reimplement currentChanged and selectionChanged problems ??
I have never 'converted' a protected virtual function into a public slot, so I have no idea whether it can/should work, but what is certain is that you are not calling any of the parent's implementation of those methods and that might be the cause of your problem. Have you tried to put a trace in your version of those methods, just to make sure that they are actually being executed?
Re: Reimplement currentChanged and selectionChanged problems ??
But they are slots. So If I use a Qwidget extendig a QTableView I have to declare as public slots , ins't ?
And this are the only properties I set :
Code:
this->setSortingEnabled(false);
this->horizontalHeader()->setStretchLastSection(true);
By now, I have to comment selectionchanged.
Another strange behavior is that every cell I click remains selected,.
Keep needing help on this.
Re: Reimplement currentChanged and selectionChanged problems ??
Quote:
Originally Posted by
tonnot
Keep needing help on this.
No, what you need is to do your homework and read Qt's documentation (more carefully, if you have already read it).
Re: Reimplement currentChanged and selectionChanged problems ??
From help : (model view tutorial)
Views manage selections within a separate selection model, which can be retrieved with the selectionModel() method. We retrieve the selection Model in order to connect a slot to its selectionChanged() signal.
So, I have now something likethis:
Ok, now it works (not very well but I have not the last problems)
And, I can to reimplement the currentChanged slot or is it forbidden ?
PS: I pray everyday in order QT people include more information into QT Reference