Sorry, in my previous message, read « Qt Creator » instead of « Qt Designer ». The new development environment
Qt Creator allows you to automatically generate signal handlers.
But, if you want to do it manually, put in your header file :
|
Source code
|
1
2
|
private slots:
void OnButtonClick();
|
Put in your source file :
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
|
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::MainWindowClass)
{
...
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(OnButtonClick()));
}
void MainWindow::OnButtonClick()
{
ui->stackedWidget->setCurrentIndex(1);
qDebug("index changed"); // for testing purposes
}
|