Let Qt pick the default window position.
(For GraphicsWindowQt5 only)
This commit is contained in:
parent
bafcf2de38
commit
40cc4cc02c
2 changed files with 16 additions and 3 deletions
|
@ -409,7 +409,15 @@ bool GraphicsWindowQt5::init( Qt::WindowFlags f )
|
|||
if ( _ownsWidget )
|
||||
{
|
||||
_window->setTitle( _traits->windowName.c_str() );
|
||||
_window->setPosition( _traits->x, _traits->y );
|
||||
|
||||
// to get OS-dependant default positioning of the window (which is desirable),
|
||||
// we must take care to only set the position if explicitly requested.
|
||||
// hence we set X & Y to these marker values by default.
|
||||
// And hence only set position if both are valid.
|
||||
if ((_traits->x != std::numeric_limits<int>::max()) && (_traits->y != std::numeric_limits<int>::max())) {
|
||||
_window->setPosition( _traits->x, _traits->y );
|
||||
}
|
||||
|
||||
QSize sz(_traits->width, _traits->height);
|
||||
if ( !_traits->supportsResize ) {
|
||||
_window->setMinimumSize( sz );
|
||||
|
@ -419,6 +427,8 @@ bool GraphicsWindowQt5::init( Qt::WindowFlags f )
|
|||
}
|
||||
|
||||
if (windowData->createFullscreen) {
|
||||
// this doesn't seem to actually work, so we
|
||||
// check the flag again in realizeImplementation()
|
||||
_window->setWindowState(Qt::WindowFullScreen);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include <Main/fg_props.hxx>
|
||||
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
|
||||
#if defined(SG_MAC)
|
||||
#include <osgViewer/api/Cocoa/GraphicsWindowCocoa>
|
||||
|
@ -112,8 +113,10 @@ void WindowBuilder::makeDefaultTraits(bool stencil)
|
|||
traits->supportsResize = true;
|
||||
traits->width = fgGetInt("/sim/startup/xsize");
|
||||
traits->height = fgGetInt("/sim/startup/ysize");
|
||||
traits->x = 50;
|
||||
traits->y = 50;
|
||||
|
||||
// these are marker values to tell GraphicsWindowQt5 to use default x/y
|
||||
traits->x = std::numeric_limits<int>::max();
|
||||
traits->y = std::numeric_limits<int>::max();
|
||||
#else
|
||||
SG_LOG(SG_VIEW,SG_ALERT,"requested Qt GraphicsWindow in non-Qt build");
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue