全屏小部件 [英] Fullscreen widget

查看:28
本文介绍了全屏小部件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使我的小部件全屏显示?我试过这样的事情:

How can I make my widget fullscreen? I've tried something like this:

void MainWindow::SetFullScreen()
{
    // Make our window without panels
    this->setWindowFlags( Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint );
    // Resize refer to desktop
    this->resize( QApplication::desktop()->size() );

    this->setFocusPolicy( Qt::StrongFocus );
    this->setAttribute(Qt::WA_QuitOnClose, true);

    qApp->processEvents();
    show();
    this->setFocus();
}

但是小部件不在系统面板上.还有其他想法吗?

But widget isn't over system panels. Any another ideas?

操作系统:Linux

推荐答案

QWidget::showFullScreen() 正是你所需要的 - 在我的项目中在 Linux+Windows 下运行多年 - 但要小心,不应有两次调用此函数(例如,第一次调用 QMainWindo->showFullScreen(),然后是 MyWidget->showFullScreen()).

QWidget::showFullScreen() is what you need - works great under Linux+Windows in my projects for years - but be careful, there shouldn't be two calls of this function (eg. first call of QMainWindo->showFullScreen() and then MyWidget->showFullScreen()).

咲,克里斯

这篇关于全屏小部件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆