Sorry for double post, but I can't find edit button?
I have a final question. Can someone please clarify for me. These are two slots I have, which I have explicitly connected.
.h:
public slots:
void create_chara_triggered();
void exit_now();
public slots:
void create_chara_triggered();
void exit_now();
To copy to clipboard, switch view to plain text mode
.cpp:
QObject::connect(createbutton,
SIGNAL(clicked
()),
this,
SLOT(create_chara_triggered
()));
QObject::connect(exitbutton,
SIGNAL(clicked
()),
this,
SLOT(exit_now
()));
void MainWindow::exit_now(){
this->close();
}
void MainWindow::create_chara_triggered(){
Dialog mDialog;
mDialog.exec();
}
QObject::connect(createbutton, SIGNAL(clicked()), this, SLOT(create_chara_triggered()));
QObject::connect(exitbutton, SIGNAL(clicked()), this, SLOT(exit_now()));
void MainWindow::exit_now(){
this->close();
}
void MainWindow::create_chara_triggered(){
Dialog mDialog;
mDialog.exec();
}
To copy to clipboard, switch view to plain text mode
They are both almost identical. The createbutton slot works, but it says there is no exit_now slot in mainwindow. I honestly don't understand why sometimes slots just don't seem to work? I've tried renaming a few times, and cleaning/rebuilding. My errors previously in the thread were due to connecting by name and trying to pass 'int value' instead of just 'int' into the slot, but this isn't relevant here. Especially when createbutton works when it's been coded in almost exactly the same way.
Thanks again.
edit: after some browsing I feel like the issue is with the moc files. I'm writing this code in visual studio and the moc files are supposed to be automatically generated. I'm not sure how to force them to regenerate, so I guess this is where the problem is.
Bookmarks