当前位置:网站首页>Use QT designer interface class to create two interfaces, and switch from interface 1 to interface 2 by pressing the key

Use QT designer interface class to create two interfaces, and switch from interface 1 to interface 2 by pressing the key

2022-07-05 17:38:00 Snow without fragrance

Ideas : Button click function hide window 1 meanwhile emit Broadcast click signal ( Add by yourself ),main Use connect, window 1 Send a click signal , Run window 2show Show function

Step one :Add new——QT—— Designer interface class

Step two : Window one

signals:
    void Show_EnterBtn();// The login button is clicked 

private slots:
    void on_EnterBtn_clicked();// Login button corresponding function : Close the login screen , Broadcast login button click signal 
void Enter::on_EnterBtn_clicked()
{
    this->hide();// Hidden window 1
    emit Show_EnterBtn();// Broadcast button click signal 
}

Step three : Window two

private slots:
    void  Show_FuncSelect();// Display window 2

Step four :main function

 QObject::connect(&mEnter,SIGNAL(Show_EnterBtn()),&mFuncSelect,SLOT(Show_FuncSelect()));// Click button , close window 1, Display window 2

原网站

版权声明
本文为[Snow without fragrance]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/186/202207051713559560.html