#include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow w; // w.setWindowFlag(Qt::FramelessWindowHint, true); /* Adding this line will warn. * warn:setGeometry: Unable to set geometry 500x500+0+0 (frame: 500x500+0+0) on QWidgetWindow/"QMainWindowClassWindow" */ QPushButton btn("btn"); QObject::connect(&btn, &QPushButton::clicked, [&w](){ w.resize(500, 500); }); w.setCentralWidget(&btn); w.showMaximized(); return a.exec(); }