hi all,
i m implementing a stack. the contents of which are class stack.
definition of class stack :
//stack.h
class cellSpec
{
int row,col;
public:
cellSpec(int,int);
void operator=(const cellSpec & temp);
};
class stack
{
QList<cellSpec> cellAdd;
public:
// stack(const stack &);
// stack operator=(stack &);
};
//stack.h
class cellSpec
{
int row,col;
public:
cellSpec(int,int);
void operator=(const cellSpec & temp);
};
class stack
{
QString lastAction;
QTableWidget *table;
QStringList Contents;
QList<cellSpec> cellAdd;
public:
stack(QStringList Contents,QTableWidget *table,QList<cellSpec> cellAdd,QString lastAction="none");
// stack(const stack &);
// stack operator=(stack &);
};
To copy to clipboard, switch view to plain text mode
//stack.cpp
#include "Stack.h"
cellSpec::cellSpec(int r,int c)
{
row = r;
col = c;
}
void cellSpec::operator=(const cellSpec & temp)
{
row = temp.row;
col = temp.col;
}
{
lastAction = lastAction;
table = table;
Contents << Contents;
cellAdd = cellAdd;
}
/*
stack::stack(const stack &stack)
{
// return stack;
}
/*
stack stack::operator=(stack &stack)
{
return stack;
}
*/
//stack.cpp
#include "Stack.h"
cellSpec::cellSpec(int r,int c)
{
row = r;
col = c;
}
void cellSpec::operator=(const cellSpec & temp)
{
row = temp.row;
col = temp.col;
}
stack::stack(QStringList Contents,QTableWidget *table,QList<cellSpec> cellAdd,QString lastAction)
{
lastAction = lastAction;
table = table;
Contents << Contents;
cellAdd = cellAdd;
}
/*
stack::stack(const stack &stack)
{
// return stack;
}
/*
stack stack::operator=(stack &stack)
{
return stack;
}
*/
To copy to clipboard, switch view to plain text mode
i m receiving error :
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qvector.h(323) : error C2512: 'stack' : no appropriate default constructor available
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qlist.h(179) : while compiling class-template member function 'void __thiscall QVector<class stack>::realloc(int,int)'
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qvector.h(362) : error C2512: 'stack' : no appropriate default constructor available
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qlist.h(179) : while compiling class-template member function 'void __thiscall QVector<class stack>::realloc(int,int)'
Stack.cpp
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qvector.h(323) : error C2512: 'stack' : no appropriate default constructor available
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qlist.h(179) : while compiling class-template member function 'void __thiscall QVector<class stack>::realloc(int,int)'
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qvector.h(362) : error C2512: 'stack' : no appropriate default constructor available
C:/Qt/4.1.2/include\QtCore/../../src/corelib/tools/qlist.h(179) : while compiling class-template member function 'void __thiscall QVector<class stack>::realloc(int,int)'
Stack.cpp
To copy to clipboard, switch view to plain text mode
main prg
{
QStack<stack> undoStack;
cellSpec cell(row,col);
QList<cellSpec> cellList;
cellList << cell;
cellList.append(cell);
stack row1(Contents,table,cellList,lastAction);
undoStack.push(row1);
}
void QGrid::pushUndo(QString lastAction,QTableWidget *table,QStringList Contents,int row,int col)
{
QStack<stack> undoStack;
cellSpec cell(row,col);
QList<cellSpec> cellList;
cellList << cell;
cellList.append(cell);
stack row1(Contents,table,cellList,lastAction);
undoStack.push(row1);
}
To copy to clipboard, switch view to plain text mode
What can be the problem
Bookmarks