passing and modifying arrays in widgets

Ok, so I have a program that stores some settings in an array. These settings get modified in a separate window, which I have constructed as a widget. The settings get referenced elsewhere, but only modified in this widget. I'm attempting to set up the pointers/references/whatever is needed so that I can pass in a pointer to the array, copy it to an internal variable and make changes as needed. All the changes need to be accessible to the original program. How do I do this?

//From parent.cpp
MyWidget* newWidget = new MyWiget(parent, /*array stuff*/);
newWidget->show();

//From widget.h
class MyWidget : public Widget
{

public:
MyWidget(Widget*, /*some kind of array stuff*/);
.
.
.
}

//From widget.cpp
MyWidget::MyWidget(Widget* pParent,/*some kind of array stuff*/)
: Widget(pParent...)
{
/*in here create a local pointer to the array*/
/*when the widget is closed, new values get assigned
to the array - new values must be accessible from parent*/
}

Help is much appreciated.
Let me make sure I understand you correctly...

You have a program that runs a widget, which then modifies an array which the original program has. You then want the original program to have the changed version after the widget closes.

Is this right?

If so...does the original program need to keep running while the widget is editing or can it wait?
Yep, that's pretty much it.

I'd prefer to allow the program to keep running - it's more straightforward code and a more practical interface.
Last edited on
Topic archived. No new replies allowed.