QPushButton *button = new QPushButton("Click me!", this); button->resize(100, 50);
QPushButton *button = new QPushButton("Submit", this); button->setGeometry(QRect(QPoint(100, 100), QSize(80, 30))); button->resize(100, 50);This code creates a push button with the label "Submit" at position (100, 100) on the screen and sets its initial size to be 80 pixels wide and 30 pixels tall. Then, the resize() function is used to adjust its size to be 100 pixels wide and 50 pixels tall. Package library: QtWidgets.