Hi, I'm new to QT and c++ and need some help. Im making a application for circuit board spesifications.
I have a class Panel which have a list of boards:QList<Board>, and in the Board class i have a Qlist of Layers, Qlist<Layer>. Im trying to modify my layer class values through two QLists, but the values wont budge. any idea?
//layer.h
private:
public:
//layer.cpp
void layer
::setType(QString newType
){newType
= type;
} QString layer
::getType(){return type;
}
//layer.h
private:
QString type;
public:
QString getType();
void setType(QString newType);
//layer.cpp
void layer::setType(QString newType){newType = type;}
QString layer::getType(){return type;}
To copy to clipboard, switch view to plain text mode
//board.h
private:
QList<layer> layers;
public:
void addLayer();
QList<layer> getLayers();
//board.cpp
QList<layer> Board::getLayers(){return layers;}
void Board::addLayer(){
layer new1;
layers.append(new1);
}
//board.h
private:
QList<layer> layers;
public:
void addLayer();
QList<layer> getLayers();
//board.cpp
QList<layer> Board::getLayers(){return layers;}
void Board::addLayer(){
layer new1;
layers.append(new1);
}
To copy to clipboard, switch view to plain text mode
//panel.h
QList<Board> b;
Board testBoard;
//panel.cpp
b.append(testBoard);
b.operator [](0).addLayer(); //adding a layer is no problem
b.operator [](0).getLayers().operator [](0).setType("nooo");
//trying to set the value, but nothing happends.
QString check
= b.
value(0).
getLayers().
value(0).
getType();
//the check value returns the initial value of type from the constructor.
//panel.h
QList<Board> b;
Board testBoard;
//panel.cpp
b.append(testBoard);
b.operator [](0).addLayer(); //adding a layer is no problem
b.operator [](0).getLayers().operator [](0).setType("nooo");
//trying to set the value, but nothing happends.
QString check = b.value(0).getLayers().value(0).getType();
//the check value returns the initial value of type from the constructor.
To copy to clipboard, switch view to plain text mode
I appreciate any help. Thx
Terje H
Bookmarks