[Development] QWidget::setWindowState(Qt::WindowStates) vs QWindow::setWindowState(Qt::WindowState)

Bo Thorsen bo at vikingsoft.eu
Thu Jan 19 09:25:07 CET 2017

Hej Thomas,

Please don't take silence as some indication that people are offended. I 
just think you found a corner case that no one has considered and do not 
consider one way or the other.

You ask for the best way to proceed: As usual with issues like this, you 
should enter a bug in the bug tracker.

Bo Thorsen.

Den 18-01-2017 kl. 16:21 skrev Thomas S√łndergaard:
> I hope my previous email wasn't offensive or downright stupid; no one
> has replied. I certainly meant no disrespect. While I'm waiting for a
> response, let me throw a specific proposal out there.
> First, I assume the correct solution is to extend QWindow and
> QPlatformWindow so they can deal with compound states such as
> Qt::WindowMaximized|Qt::WindowMinimized, just like QWidget can. Since
> QWindow::setWindowState(Qt::WindowState) and Qt::WindowState
> QWindow::windowState() cannot be modified, I'm thinking of adding
> Qt::WindowStates QWindow::fullWindowState() const;
> void QWindow::setFullWindowState(Qt::WindowStates);
> and
> Qt::WindowStates QPlatformWindow::fullWindowState() const;
> void QPlatformWindow::setFullWindowState(Qt::WindowStates);
> The existing QWindow::windowState() would then be implemented using the
> effectiveState() function from qwidget.cpp (I'd move it over)
> I can experiment with these changes and implementing them in the xcb and
> windows platform plugins, but early feedback is always great, so I avoid
> wasting time.
> Thanks for making Qt
> Thomas
> On 17 January 2017 at 21:37, Thomas S√łndergaard
> <thomas.sondergaard at karoshealth.com
> <mailto:thomas.sondergaard at karoshealth.com>> wrote:
>     Hi,
>     I'm looking at the Qt code with intention to fix it so this code
>         QWidget widget;
>         widget.setWindowState(Qt::WindowMaximized);
>         widget.showMinized();
>     will show the window iconified and when the user (or program)
>     unminimize the window it pops up maximized. This is currently not
>     possible (QTBUG-57882 <https://bugreports.qt.io/browse/QTBUG-57882>).
>     I've been trying to read the Qt code and it seems to me the problem
>     is that QWindow::setWindowState(Qt::WindowState) and
>     QPlatformWindow::setWindowState(Qt::WindowState) only take a
>     Qt::WindowState argument not a Qt::WindowStates argument. This seems
>     to make it impossible to set the correct state on the windows-system
>     window.
>     Is this intentional or a known issue?
>     I would be happy to get suggestions for how this is best fixed.

Bo Thorsen,
Director, Viking Software.

Viking Software
Qt and C++ developers for hire

More information about the Development mailing list