Основной класс:
Код: Выделить всё
class UI : public QWidget
{
public:
UI(){connection();};
private:
QPushButton* all = new QPushButton{ "ALL" };
void connection(){
QObject::connect(all,QPushButton::clicked,[](){
SmallGUI* s=new SmallGUI{};
s->show();
});
}
void something() {
//something
}
};
Код: Выделить всё
class SmallGUI1 :
public QWidget
{
public:
SmallGUI(){connection();};
private:
QPushButton* N = new QPushButton;
void connection() {
//to connect N to something()
}
};
Подробнее здесь: https://stackoverflow.com/questions/625 ... ew-created