//program.cpp
program
::program(QWidget *parent
) : ui(new Ui::program)
{
ui->setupUi(this);
wnd1 w1;
w1.Initialize();
}
//window1.cpp
void wnd1::Initialize() {
connect(ui->button1, SIGNAL(clicked()), this, SLOT(test1()));
connect(ui->button2, SIGNAL(clicked()), this, SLOT(tes2t()));
connect(ui->button3, SIGNAL(clicked()), this, SLOT(test3()));
connect(ui->button4, SIGNAL(clicked()), this, SLOT(test4()));
connect(ui->button5, SIGNAL(clicked()), this, SLOT(test5()));
// but i don't know how to get a handle the buttons in window1.cpp since 'ui' is from program.cpp
}
//program.cpp
program::program(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::program)
{
ui->setupUi(this);
wnd1 w1;
w1.Initialize();
}
//window1.cpp
void wnd1::Initialize() {
connect(ui->button1, SIGNAL(clicked()), this, SLOT(test1()));
connect(ui->button2, SIGNAL(clicked()), this, SLOT(tes2t()));
connect(ui->button3, SIGNAL(clicked()), this, SLOT(test3()));
connect(ui->button4, SIGNAL(clicked()), this, SLOT(test4()));
connect(ui->button5, SIGNAL(clicked()), this, SLOT(test5()));
// but i don't know how to get a handle the buttons in window1.cpp since 'ui' is from program.cpp
}
To copy to clipboard, switch view to plain text mode
Bookmarks