PDA

View Full Version : 'QList' does not name a type



Qt Coder
22nd September 2009, 14:20
I m writing a function in which I take QList<QString> as argument and after manipulating returns the same.




//Header File

#include <QtGui/QMainWindow>
#include <qlist.h>
#include <string.h>

class MainWindow : public QMainWindow
{

Q_OBJECT

public:
MainWindow(QWidget *parent = 0);
~MainWindow();
QList GetArray(QList<QString> final);
};


//Source file

QList<QString> MainWindow::GetArray(QList final)
{
QList<QString> finalList;
//finalList manipulating code
return finalList;

}




but when I compile ,it gives me following errors


In file included from mainwindow.cpp:1:
mainwindow.h:49: error: `QList' does not name a type
mainwindow.cpp: At global scope:
mainwindow.cpp:338: error: `QList<QString> MainWindow::GetArray' is not a static
member of `class MainWindow'
mainwindow.cpp:338: error: missing template arguments before "final"
mainwindow.cpp:339: error: expected `,' or `;' before '{' token
mingw32-make[1]: *** [tmp/obj/debug_shared/mainwindow.o] Error 1
mingw32-make[1]: Leaving directory `D:/Qt/4.4.3/examples/widgets/ASystem'
mingw32-make: *** [debug-all] Error 2

Lykurg
22nd September 2009, 14:40
it has to be
QList<QString> MainWindow::GetArray(QList<QString> final)

or you use QStringList.

kwisp
22nd September 2009, 15:03
try

#include <QString>
#include <QList>

Qt Coder
22nd September 2009, 15:28
QList<QString> MainWindow::GetArray(QList<QString> final)


worked !!!! thaanx