Added logic to make force the default Qt style to be a known good value. This is windows style for windows platform and fusion style for linux and mac osx. Depending on which Qt style plugins are installed on the OS, certain ones are known to be unstable (such as gtk2 style).

This commit is contained in:
mjbudd77 2021-04-18 19:18:05 -04:00
parent 72588e0eec
commit b8cb24499f
1 changed files with 27 additions and 2 deletions

View File

@ -591,11 +591,36 @@ QStyle *fceuStyle::styleBase(QStyle *style) const
if ( s.size() == 0 )
{
int i, idx = -1;
#ifdef WIN32
QString defaultStyle("windows");
#elif __APPLE__
QString defaultStyle("fusion");
#else
QString defaultStyle("fusion");
#endif
QStringList styleKeys = QStyleFactory::keys();
if ( styleKeys.size() > 0 )
for (i=0; i<styleKeys.size(); i++)
{
s = styleKeys[0].toStdString();
//printf("Style: '%s'\n", styleKeys[i].toStdString().c_str() );
if ( defaultStyle.compare( styleKeys[i], Qt::CaseInsensitive ) == 0 )
{
//printf("Style Match: %s\n", styleKeys[i].toStdString().c_str() );
idx = i;
break;
}
}
if ( (idx >= 0) && (idx < styleKeys.size()) )
{
s = styleKeys[idx].toStdString();
}
else
{
s.assign("fusion");
}
}