Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
160 views
in Technique[技术] by (71.8m points)

c++ - Fullscreen widget

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?

OS: Linux

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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()).

ciao, Chris


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...