Nominate our 2022 Qt Champions!

Use QDesktopwidget::availableGeometry to show QMainWindow maximized

  • I'm building a QT application for Windows 7, using MinGW. In my code, I have a class derived from QMainWindow. This mainwindow is showed and closed several times (over different screens). I'm showing the window using the following code:


    Only the first time when this code is exectued, the window is showed as expected. The next times, the window is showed maximized, but i'm missing a few pixels at the bottom of the screen.

    I also receive a warning in QT, when the code is executed:

    setGeometryDp: Unable to set geometry 1600x1172+0+0 on QWidgetWindow/'CDisplayClassWindow'. Resulting geometry: 1600x1150+0+22 (frame: 8, 30, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 780x539, maximum size: 16777215x16777215).

    What i don't understand is that the geometry returned by desktop() >availableGeometry looks like to be incorrect. My question is, how can i determine the geometry showed in the warning message?(1600x1150+0+22)

  • Moderators

    If I'm understanding correctly what you're attempting, just use QWidget::showFullScreen. Also I don't see a reason why you'd want to block the signals, could you elaborate on that?

    Kind regards.

Log in to reply