Ok....Things are starting to get clearer...still a couple of problems. To help make it understandable but brief I have my MainWindow class that has a stacked widget on it. Then I have my NamePage class.
My first problem is probably basic C++ stuff, but I can't seem to resolve it. In my NamePage class I have some functions that I need to call from my MainWindow class in a couple of places. I declare a pointer to a NamePage class on the heap in my constructor for the MainWindow class (called name). I thought that by doing so, I could reference the functions in each place in my MainWindow class, but it doesn't work that way. Do I have to create a pointer to a class in each function where I need to access the functions. What is the best way to do that.
The second issue is how to reference a lineedit widget on the NamePage ui from the MainWindow class.
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
NamePage *name=new NamePage;
ui->setupUi(this);
ui->MainStackWidget->setCurrentIndex(0);
name->updateRiderComboBox();
}
{
if(name->saveNameDataCheck())// name not declared in this scope
{
writeSettings();
event->accept();
}
else
{
writeSettings();
event->ignore();
}
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
NamePage *name=new NamePage;
ui->setupUi(this);
ui->MainStackWidget->setCurrentIndex(0);
name->updateRiderComboBox();
}
void MainWindow::closeEvent(QCloseEvent *event)
{
if(name->saveNameDataCheck())// name not declared in this scope
{
writeSettings();
event->accept();
}
else
{
writeSettings();
event->ignore();
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks