mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-24 17:08:36 -05:00
Display OpenGL version in status bar. Displayed in red if less than version 3.
This commit is contained in:
parent
fe68e41575
commit
bb3bc6e527
@ -40,6 +40,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 6, 0)
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps
|
||||
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); // Needed for WebGL in QWebEngineView and MainWindow::openGLVersion
|
||||
#endif
|
||||
|
||||
QApplication a(argc, argv);
|
||||
|
@ -865,14 +865,43 @@ void MainWindow::saveCommandSettings()
|
||||
{
|
||||
}
|
||||
|
||||
QString MainWindow::openGLVersion()
|
||||
{
|
||||
QOpenGLContext *glCurrentContext = QOpenGLContext::globalShareContext();
|
||||
if (glCurrentContext)
|
||||
{
|
||||
if (glCurrentContext->isValid())
|
||||
{
|
||||
int major = glCurrentContext->format().majorVersion();
|
||||
int minor = glCurrentContext->format().minorVersion();
|
||||
bool es = glCurrentContext->isOpenGLES();
|
||||
QString version = QString("%1.%2%3").arg(major).arg(minor).arg(es ? " ES" : "");
|
||||
// Waterfall doesn't work if major version is less than 3, so display in red
|
||||
if (major < 3) {
|
||||
version = "<span style=\"color:red\">" + version + "</span>";
|
||||
}
|
||||
return version;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "N/A";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "N/A";
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::createStatusBar()
|
||||
{
|
||||
QString qtVersionStr = QString("Qt %1 ").arg(QT_VERSION_STR);
|
||||
QString openGLVersionStr = QString("OpenGL %1 ").arg(openGLVersion());
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
|
||||
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr
|
||||
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr + openGLVersionStr
|
||||
+ QSysInfo::currentCpuArchitecture() + " " + QSysInfo::prettyProductName(), this);
|
||||
#else
|
||||
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr, this);
|
||||
m_showSystemWidget = new QLabel("SDRangel " + qApp->applicationVersion() + " " + qtVersionStr + openGLVersionStr, this);
|
||||
#endif
|
||||
statusBar()->addPermanentWidget(m_showSystemWidget);
|
||||
|
||||
|
@ -129,6 +129,7 @@ private:
|
||||
void saveFeatureSetPresetSettings(FeatureSetPreset* preset, int featureSetIndex);
|
||||
void saveCommandSettings();
|
||||
|
||||
QString openGLVersion();
|
||||
void createStatusBar();
|
||||
void closeEvent(QCloseEvent*);
|
||||
void updatePresetControls();
|
||||
|
Loading…
Reference in New Issue
Block a user