I want my window to have four different modes:
- Fullscreen
- Maximized without a border (like fullscreen, but the taskbar is still visible)
- Maximized
- Windowed (non-resizable)

Windowed works fine, and maximized without a border works fine, but regular maximized isn't working.

Regular plain-vanilla Maximized is filling up the entire screen including under the taskbar.

Here's a screenshot showing what I mean:

screenshot.png
(editted, to cut down on resolution by cutting out blank space)

I've tried multiple different ways of setting maximized, including:
Qt Code:
  1. QWidget::setWindowFlags(Qt::Window);
  2. QWidget::setWindowState(Qt::WindowActive, Qt::Maximized);
To copy to clipboard, switch view to plain text mode 

I also tried manually re-sizing it, and I tried using QWidget::showMaximized().

Here's my current code:
Qt Code:
  1. void MainWindow::_recalculateWindowSize()
  2. {
  3. //Undo any previous minimums and maximums.
  4. QWidget::setMinimumSize(0, 0);
  5. QWidget::setMaximumSize(1000000, 1000000);
  6.  
  7. //Choose what settings to use, depending on WindowMode.
  8. if(this->windowMode == Engine::WindowMode::Fullscreen)
  9. {
  10. QWidget::setWindowFlags(Qt::Window);
  11. QWidget::resize( qApp->desktop()->size() );
  12. QWidget::showFullScreen();
  13. }
  14. else if(this->windowMode == Engine::WindowMode::Multitask)
  15. {
  16. QWidget::setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
  17.  
  18. QRect desktopGeometry = qApp->desktop()->availableGeometry();
  19. QWidget::resize(desktopGeometry.size());
  20. QWidget::move(desktopGeometry.x(), desktopGeometry.y());
  21.  
  22. QWidget::setWindowState(Qt::WindowActive); //Qt::Maximized
  23. }
  24. else if(this->windowMode == Engine::WindowMode::Maximized)
  25. {
  26. QWidget::setWindowFlags(Qt::Window);
  27.  
  28. //QWidget::setGeometry(qApp->desktop()->availableGeometry());
  29. QWidget::showMaximized();
  30. }
  31. else //Engine::WindowMode::Windowed
  32. {
  33. WindowSize windowSize = this->_calculateWindowSizeWithEditor(this->requestedWindowSize);
  34.  
  35. QWidget::setWindowFlags(Qt::Window | Qt::WindowMinMaxButtonsHint);
  36.  
  37. QWidget::showNormal();
  38. QWidget::resize(windowSize.ToQSize());
  39. //QWidget::setFixedSize(windowSize.ToQSize());
  40.  
  41. QWidget::move(50, 50); //Temp, haven't cent
  42. }
  43.  
  44. QWidget::show(); //Have to 'show()' to apply the new setWindowState() state.
  45. QWidget::grabKeyboard(); //Just incase we accidentally lost focus during the transition.
  46. }
To copy to clipboard, switch view to plain text mode 

MainWindow private inherits QWidget (but brings QObject into the public interface), and has no parent.
(Note: It's not a QMainWindow, if that matters. I have no QMainWindow, just a parentless QWidget)

Any ideas what I'm doing wrong?