Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] 'QAbstractListModel' does not name a type
I have searched this site and google for help with this and have not found anything. Forgive me if this has been answered elsewhere. I have only been using Qt for the past four months and I have easily found answers for any other issue I have encountered. I am hoping someone can help me out.
I am learning about Qt Model/View. I added a class that subclassed QAbstractListModel. I ended up removing the files I created for the model (header and cpp). After removing them I now get a handful of errors.
I have tried cleaning all, running qmake, and rebuilding but it did not help this time. I even opened up a saved version of my project from a day ago and it is throwing the same errors.
Here is an image of all the issues: http://postimg.org/image/x2sh482x9/
I am using:
Qt Creator 3.0.0
MinGW 32 bit
I have had errors like "... does not name a type" or "ISO C++ forbids declaration of a 'parameter' with no type" and have been able to resolve them. I am not sure what to do to resolve these errors.
I will keep this initial post short in the hopes that someone out there knows how to help me resolve this.
Thank you for your help.
Hi and welcome to devnet,
This error means that you are somewhere in your code using a pointer to a QAbstractItemModel without including the header in the corresponding cpp file
Thank you for your reply and also for all the other answers you have posted on these forums. Your posts have answered many of my questions over the last few months.
I only included 'QAbstractItemModel' in one class and that is now removed from my project. I searched 'All Projects' for 'QAbstractItemModel' and got no results. I also searched for 'QAbstract' and 'Model' and got no results for any of them.
I have had odd errors like these along the way and running qmake usually resolves them. Is it possible that there is some file hanging around that could be causing this?
The odd thing is that I opened an old version of my project from the time before I had done anything with QAbstractItemModel and it is throwing the same errors now.
You're welcome :)
Are you using any class that is derived from QAbstractListModel ?
I did have a class that derived from QAbstractListModel but I removed it. It was right after I removed that class that the errors appeared. The errors now also come up for an old version of my project that was from prior to me messing around with QAbstractListModel.
Errors usually point me to the file with the problem and it is always my class or header. These errors point to header files found in QtCore. That is not to say the problem is not something I did. Just that I can't figure out where to look to resolve this.
I ended up installing Qt 5.3. I opened my project and it built without error and is back to normal now. I guess something became messed up with my Qt install.
Thank you again for helping me out, SGaist.
You're welcome !
Strange anyway, but as long as you have it working… Can you also please update the thread title prepending [solved] so other forum users may know a solution has been found :)