QPushButton *button1 = new QPushButton("Click me!", this); button1->hide(); // hides the button
void MyClass::on_buttonClicked() { button2->hide(); // hides the button when clicked } void MyClass::createUi() { button2 = new QPushButton("Hide me!", this); connect(button2, SIGNAL(clicked()), this, SLOT(on_buttonClicked())); // connects the button click signal to the on_buttonClicked() slot }In this example, a QPushButton object is created and then connected to a slot that hides the button when it is clicked. The button is created and connected in the createUi() function. Package/Library: QPushButton is part of the Qt library, which is a cross-platform C++ application framework for GUI and non-GUI programming tasks.