与主 - > hide() - 但不起作用。
我想要单击主页上的按钮以切换到另一页。I尝试使用库QSTACKEDWIDGET基于qt6 c ++ clion在Web应用程序上切换页面。但是主页没有进行。第二页在Main上写。单击任何按钮时如何删除第一页?
与主 - > hide() - 但不起作用。我没有QT6的WebApps经验。在常规桌面C ++应用中,我经常使用这样的代码。
void switchToView(QWidget* pPage) {
qDebug() << "trying to switch to another view";
if (!pPage) {
qDebug() << "the new view is NULL, aborting...";
return;
}
if (pPage->parentWidget() != ui->stackedWidget) {
qDebug() << "the new view is not a page of the stacked widget, aborting...";
return;
}
qDebug() << "switching to page" << pPage->objectName();
ui->stackedWidget->setCurrentWidget(pPage);
}