Hi everybody,
How can I declare an array of shape in QPainter?
In the header file, I have an enumerated shape. It works fine without making array. But now I want to have an array of size 10 of this enumerated shape. I could not successfully convert the shape to an array of size 10. Please help..
Here are my code pieces:
my header file
enum Shape {Kare, Hexa, Rect};
void setShape(Shape shape[10]);
Shape shape[10];
enum Shape {Kare, Hexa, Rect};
void setShape(Shape shape[10]);
Shape shape[10];
To copy to clipboard, switch view to plain text mode
my cpp file
void RenderArea1::setShape(Shape shape[10])
{
for (int kat = 0; kat < 10; kat += 1) {
this->shape[kat] = shape[kat];
update();
}
}
for (int kat = 0; kat < 10; kat += 1) {
switch (shape[kat]) {
case Kare:
....
case Hexa:
....
case Rect:
....
}
}
RenderArea1::Shape shape[Window::kat] = renderArea1->Kare;
renderArea1->setShape(shape[Window::kat]);
renderArea1->update();
void RenderArea1::setShape(Shape shape[10])
{
for (int kat = 0; kat < 10; kat += 1) {
this->shape[kat] = shape[kat];
update();
}
}
for (int kat = 0; kat < 10; kat += 1) {
switch (shape[kat]) {
case Kare:
....
case Hexa:
....
case Rect:
....
}
}
RenderArea1::Shape shape[Window::kat] = renderArea1->Kare;
renderArea1->setShape(shape[Window::kat]);
renderArea1->update();
To copy to clipboard, switch view to plain text mode
Thanks in advance..
Bookmarks