views:

4703

answers:

1

Hello, i have a question. 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

Lang: c++

+8  A: 

Hi,

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

3DH
Thanks. Works greatly!
Ockonal
Unless "MyWidget" is another window MyWidget->showFullScreen() won't do anything.
Graphics Noob
how about multiple screen setups with XRandr,Eyefinity or Xinerama? Does this work properly?
penguinpower
multiple screens should work - but by default showFullscreen() only uses one screen - but you can determine the whole desktop size (inluding multiple monitors/screens) and set the geometry manually...
3DH