QWidget
has a public slot called show(). You can connect your button's clicked() signal to your widget's show() slot. Read more about signals and slots here.
Example:
QPushButton *button = new QPushButton(this);
QWidget *widget = new QWidget(this);
widget->setWindowFlags(Qt::Window);
connect(button, SIGNAL(clicked()), widget, SLOT(show()));
You could also create your own slot and call widget->show()
from there. Then connect the button's clicked()
signal to your slot.
Example:
//myclass.h
...
public:
QWidget *myWidget;
public slots:
void mySlot();
//myclass.cpp
...
connect(button, SIGNAL(clicked()), this, SLOT(mySlot()));
...
void MyClass::mySlot()
{
myWidget->show();
}