In short I'm trying code a canvas setup dialog for a paint application. My first realization was that I declared these two functions in two separate headers. I was wondering is there any way I can make a pointer in the createCanvas function that points to the createSpinBoxes function?
My first realization was that I declared these two functions in two separate headers. I've also tried using pointers, but they're not really working. These two functions are also in two different classes.
//This one is from a header file called "canvassetupdialog.h"
void canvasSetupDialog::createSpinBoxes()
{
int def_canW = 1920;
int def_canH = 1080;
//For the canvas Width
QSpinBox *canvasWidthSpinBox = new QSpinBox;
canvasWidthSpinBox->setRange(1, 20000);
canvasWidthSpinBox->setSingleStep(1);
canvasWidthSpinBox->setValue(def_canW);
//For the canvas Height
QSpinBox *canvasHeightSpinBox = new QSpinBox;
canvasHeightSpinBox->setRange(1, 20000);
canvasHeightSpinBox->setSingleStep(1);
canvasHeightSpinBox->setValue(def_canH);
//I wanted to be able to use these pointers in the other function below.
int *canWptr = &def_canW;
int *canHptr = &def_canH;
}
//This one is from a header file called "scribblearea.h"
void ScribbleArea::createCanvas(QImage *canvas)
{
canvas->width() = *canWptr;
canvas->height() = *canHptr;
}
What I wanted this to result in is that whatever value is picked in the spinboxes will be the set width and height of the canvas the user is going to draw on. (My second guess is that I should stick to keeping these two functions in one header file)