Use screen geometry to configure screen size

This commit is contained in:
Klaus Basan
2018-11-16 02:27:22 +01:00
parent 0b2d3c3f05
commit ff33db96db
2 changed files with 23 additions and 0 deletions

View File

@@ -62,6 +62,8 @@ namespace BlackGui
if (!sGui || sGui->isShuttingDown()) { return; }
sGui->showHelp(this);
});
this->setScreenGeometry();
}
CConfigurationWizard::~CConfigurationWizard()
@@ -126,5 +128,23 @@ namespace BlackGui
if (CMathUtils::epsilonEqual(parent->windowOpacity(), opacity)) { return; }
parent->setWindowOpacity(opacity);
}
void CConfigurationWizard::setScreenGeometry()
{
if (!sGui) { return; }
const QRect g = CGuiApplication::currentScreenGeometry();
// 1280/720 on 4k hires
// 1920/1280 on non hires 1920 displays
const int gw = g.width();
const int gh = g.height();
const int calcW = qRound(gw * 0.8);
const int calcH = qRound(gh * 0.9); // normally critical as buttons are hidden
// do not get too huge
const int w = qMin(900, calcW);
const int h = qMin(750, calcH);
this->resize(w, h);
}
} // ns
} // ns

View File

@@ -71,6 +71,9 @@ namespace BlackGui
//! Set the parent's window opacity
void setParentOpacity(qreal opacity);
//! Set screen geometry based on screen resolution
void setScreenGeometry();
QScopedPointer<Ui::CConfigurationWizard> ui;
int m_previousId = -1;
int m_minId = -1;