I have a very strange error in my Qt project. Here is the code, the main_window.h:
#include <QtGui>
#include <QtSql>
class main_window : public QTabWidget
{
Q_OBJECT
/// @name List Widgets
private:
QListWidget* m_documents_list;
....
and here is main_window.cpp:
...
void main_window::create_documents_widget()
{
m_documents = new QWidget(this);
m_documents_list = new QListWidget(m_documents);
}
...
The problem that I can't understand is in QListView, I'm not using it in my project. There is only QListWidget, but when I'm trying to build the project the following errors occur:
qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
qlistview.h:194: error: expected ',' or '...' before '&' token
Also the following strange errors:
qlistwidget.h:308: error: no 'void QListWidget::removeItemWidget(QListWidgetItem)' member function declared in class 'QListWidget'*
qlistwidget.h:311: error: no 'void QListWidget::addItem(QListWidgetItem)' member function declared in class 'QListWidget'*
qlistwidget.h:314: error: no 'QListWidgetItem QListWidget::itemAt(int, int) const' member function declared in class 'QListWidget'*
etc.
Thanks in advance.
UPD: I'm using QtCreator 2.2.1 on Windows 7.
UPD2: Qt version is 4.7.1.
UPD3: The complete output
In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:68,
from ..\my_project\/main_window.h:4,
from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ',' or '...' before '&' token
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: ISO C++ forbids declaration of 'QListView' with no type
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:194: error: expected ';' before '&' token
In file included from c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/QtGui:69,
from ..\my_project\/main_window.h:4,
from ..\my_project\main.cpp:2:
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:202: error: redefinition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistview.h:58: error: previous definition of 'class QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:308: error: no 'void QListWidget::removeItemWidget(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:311: error: no 'void QListWidget::addItem(QListWidgetItem*)' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:314: error: no 'QListWidgetItem* QListWidget::itemAt(int, int) const' member function declared in class 'QListWidget'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setSelected(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:318: error: 'class QListWidget' has no member named 'setItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isSelected() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:321: error: 'class QListWidget' has no member named 'isItemSelected'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'void QListWidgetItem::setHidden(bool)':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:324: error: 'class QListWidget' has no member named 'setItemHidden'
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h: In member function 'bool QListWidgetItem::isHidden() const':
c:\QtSDK\Desktop\Qt\4.7.3\mingw\include\QtGui/qlistwidget.h:327: error: 'class QListWidget' has no member named 'isItemHidden'