Hi,
I have a qwidget, that has as a member a 2-D array of ints. Now I'm having trouble accessing the vales in member functions of the widget.
// the .h file
class holdingWidget
: public QWidget{
Q_OBJECT
.
.
.
.
protected:
private:
int myArrayOne[44][3];
// the .h file
class holdingWidget : public QWidget
{
Q_OBJECT
.
.
.
.
protected:
void paintEvent(QPaintEvent *ev);
private:
int myArrayOne[44][3];
To copy to clipboard, switch view to plain text mode
Now in the class defintion
{
int myArrayOne[44][3] =....
.
.
.
}
{
.
.
int k = myArrayOne[0][0];
int l = myArrayOne[0][1];
}
holdingWidget::holdingWidget(QWidget* parent): QWidget(parent)
{
int myArrayOne[44][3] =....
.
.
.
}
void holdingWidget::paintEvent(QPaintEvent *ev)
{
.
.
int k = myArrayOne[0][0];
int l = myArrayOne[0][1];
}
To copy to clipboard, switch view to plain text mode
Now in the paintEvent the values are nonsense numbers and not the ones I specified above. But if I define the array in the paintevent it works ok. What am I missing here? Any help appreciated.
Bookmarks