#include "mainwindow.h" #include "ui_mainwindow.h" #include #include #include MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(sendEvent())); } MainWindow::~MainWindow() { delete ui; } void MainWindow::sendEvent() { QResizeEvent resizeEvent(QSize(800,600),this->size()); QApplication::sendEvent(this, &resizeEvent); } void MainWindow::resizeEvent(QResizeEvent* event) { QMessageBox::information(this, "MainWindow::resizeEvent reached", "Yay! Now I can display you a stupid message box every time we resize the window!"); QMainWindow::resizeEvent(event); }