子窗口// 全屏显示:
this ->setWindowFlags(Qt::Window);
this ->showFullScreen();
退出全屏时:
this->setWindowFlags(Qt::SubWindow);
this ->showNormal();
showFullScreen() // Qt全屏显示函数
showMaximized() // Qt最大化显示函数
showMinimized() // Qt最小化显示函数
resize(x, y) // Qt固定尺寸显示函数
setMaximumSize(w, h) // Qt设置最大尺寸函数
setMinimumSize(w, h) // Qt设置最小尺寸函数
窗口置顶 与 取消置顶
void MainWindow::on_windowTopButton_clicked()
{
if (m_flags == NULL)
{
m_flags = windowFlags();
setWindowFlags(m_flags | Qt::WindowStaysOnTopHint);
this->show();
}
else
{
m_flags = NULL;
setWindowFlags(m_flags);
this->show();
}
}
本文介绍了Qt中窗口的各种显示模式及状态调整方法,包括全屏、最大化、最小化、固定尺寸等,并提供了窗口置顶功能的实现示例。

1932

被折叠的 条评论
为什么被折叠?



