fix sound slider on qt6 (#4642)

This commit is contained in:
ebbit1q 2022-09-01 19:01:20 +02:00 committed by GitHub
parent 40c88fe385
commit 235adbbdf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -59,11 +59,12 @@ void SoundEngine::playSound(QString fileName)
}
player->stop();
int volumeSliderValue = SettingsCache::instance().getMasterVolume();
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
player->audioOutput()->setVolume(SettingsCache::instance().getMasterVolume());
player->audioOutput()->setVolume(qreal(volumeSliderValue) / 100);
player->setSource(QUrl::fromLocalFile(audioData[fileName]));
#else
player->setVolume(SettingsCache::instance().getMasterVolume());
player->setVolume(volumeSliderValue);
player->setMedia(QUrl::fromLocalFile(audioData[fileName]));
#endif
player->play();