"parent" in your case is the pointer to QWidget and QWidget does not have "model" member. You have to cast it to your class. Proper way to do so is to use qobject_cast like this:
myMainWindow *mmw = qobject_cast<myMainWindow *>(parent);
// now check if mmw is not NULL, because if parent would be pointer to widget different than
// your myMainWindow, qobject_cast returns NULL
if (mmw) {
model = mmw->model;
}
myMainWindow *mmw = qobject_cast<myMainWindow *>(parent);
QAbstractItemModel *model = 0;
// now check if mmw is not NULL, because if parent would be pointer to widget different than
// your myMainWindow, qobject_cast returns NULL
if (mmw) {
model = mmw->model;
}
To copy to clipboard, switch view to plain text mode
P.S. And use CODE tags in your posts.
Bookmarks