I am trying to make a function that will move the parts of an array (which is made of widgets) around a circle. It builds and runs but the icons do not appear. Can someone tell me why?
Here is the function in the .cpp file
void setIconWidgetLocation(iconWidget *w, float arcSize)
{
int outerRadius = 100;
int innerRadius = 60;
int radius = (outerRadius + innerRadius)/2;
arcSize = 2.0 * M_PI/ 5;
iconWidget *icon[5];
QSizeF size = w->size();
QPointF center(size.width(),size.height());
center /= 2.0;
//Loop for finding the circles and moving them
for(int i = 0; i<5; i++)
{
icon[i] = new iconWidget;
//Finding the Icon center on the circle
double x = center.x() + radius * sin(arcSize * i);
double y = center.y() + radius * cos(arcSize * i);
x -= 10/2;
y -= 10/2;
//moves icons into place
icon[i]->move(x,y);
}
}
and here is the header file
#ifndef ZMENUWIDGET_H
#define ZMENUWIDGET_H
#include "iconwidget.h"
#include <QWidget>
class zMenuWidget : public QWidget
{
Q_OBJECT
iconWidget *icon[5];
public:
explicit zMenuWidget(QWidget *parent = 0);
void paintEvent(QPaintEvent *event);
void resizeEvent(QResizeEvent *event);
signals:
public slots:
};
#endif // ZMENUWIDGET_H
here is the call of the setIconWidgetLocation.
#include "zmenuwidget.h"
#include <QPaintEvent>
#include <QResizeEvent>
#include <QPainter>
#include <QColor>
#include <QPainterPath>
#include <cmath>
setIconWidgetLocation(iconWidget *w, float arcSize);
zMenuWidget::zMenuWidget(QWidget *parent) :
QWidget(parent)
{
}