#include #include "mybox.h" MyBox::MyBox(QWidget *parent) : QMainWindow(parent) { QWidget *main_widget = new QWidget; this->setCentralWidget(main_widget); this->setWindowTitle("Python Welcome!"); QHBoxLayout *main_layout = new QHBoxLayout; main_widget->setLayout(main_layout); QLabel *info_label = new QLabel("Hello Qt!"); QPushButton *quit_btn = new QPushButton("Click Me!"); QPushButton *cust_btn = new QPushButton("Custom Print!"); main_layout->addWidget(info_label); main_layout->addWidget(quit_btn); main_layout->addWidget(cust_btn); // connection QObject::connect(quit_btn, SIGNAL(clicked()), this, SLOT(close())); QObject::connect(cust_btn, SIGNAL(clicked()), this, SLOT(cust_action())); } MyBox::~MyBox() { } void MyBox::cust_action(){ qDebug() << "Hello C++"; }