0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-19 20:32:15 +02:00

UI: Fix Qt 6.7 checkbox signal deprecations

qt/qtbase@3512fb1ec5 deprecated the
stateChanged signal of QCheckBoxes in favor of a new checkStateChanged
signal. The signals are the same, except that now the enum type is
passed explicitly (before the enum was passed as an argument but defined
as an int).
This commit is contained in:
gxalpha 2024-05-26 01:19:36 +02:00 committed by Ryan Foster
parent 51fd7fbaff
commit 9eca7b7525
5 changed files with 38 additions and 4 deletions

View File

@ -273,7 +273,11 @@ QWidget *OBSPropertiesView::AddCheckbox(obs_property_t *prop)
QCheckBox *checkbox = new QCheckBox(QT_UTF8(desc));
checkbox->setCheckState(val ? Qt::Checked : Qt::Unchecked);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
return NewWidget(prop, checkbox, &QCheckBox::checkStateChanged);
#else
return NewWidget(prop, checkbox, &QCheckBox::stateChanged);
#endif
}
QWidget *OBSPropertiesView::AddText(obs_property_t *prop, QFormLayout *layout,

View File

@ -790,8 +790,13 @@ OBSBasicSettings::OBSBasicSettings(QWidget *parent)
&OBSBasicSettings::SimpleReplayBufferChanged);
connect(ui->simpleRBSecMax, &QSpinBox::valueChanged, this,
&OBSBasicSettings::SimpleReplayBufferChanged);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(ui->advOutSplitFile, &QCheckBox::checkStateChanged, this,
&OBSBasicSettings::AdvOutSplitFileChanged);
#else
connect(ui->advOutSplitFile, &QCheckBox::stateChanged, this,
&OBSBasicSettings::AdvOutSplitFileChanged);
#endif
connect(ui->advOutSplitFileType, &QComboBox::currentIndexChanged, this,
&OBSBasicSettings::AdvOutSplitFileChanged);
connect(ui->advReplayBuf, &QCheckBox::toggled, this,
@ -1360,8 +1365,13 @@ void OBSBasicSettings::LoadGeneralSettings()
"HideOBSWindowsFromCapture");
ui->hideOBSFromCapture->setChecked(hideWindowFromCapture);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(ui->hideOBSFromCapture, &QCheckBox::checkStateChanged,
this, &OBSBasicSettings::HideOBSWindowWarning);
#else
connect(ui->hideOBSFromCapture, &QCheckBox::stateChanged, this,
&OBSBasicSettings::HideOBSWindowWarning);
#endif
}
#endif
@ -4713,7 +4723,11 @@ void OBSBasicSettings::SpeakerLayoutChanged(int idx)
UpdateAudioWarnings();
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void OBSBasicSettings::HideOBSWindowWarning(Qt::CheckState state)
#else
void OBSBasicSettings::HideOBSWindowWarning(int state)
#endif
{
if (loading || state == Qt::Unchecked)
return;

View File

@ -454,7 +454,12 @@ private slots:
void on_colorPreset_currentIndexChanged(int idx);
void GeneralChanged();
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
void HideOBSWindowWarning(Qt::CheckState state);
#else
void HideOBSWindowWarning(int state);
#endif
void AudioChanged();
void AudioChangedRestart();
void ReloadAudioSources();

View File

@ -71,9 +71,13 @@ OBSBasicTransform::OBSBasicTransform(OBSSceneItem item, OBSBasic *parent)
&OBSBasicTransform::OnCropChanged);
HookWidget(ui->cropBottom, ISCROLL_CHANGED,
&OBSBasicTransform::OnCropChanged);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
HookWidget(ui->cropToBounds, &QCheckBox::checkStateChanged,
&OBSBasicTransform::OnControlChanged);
#else
HookWidget(ui->cropToBounds, &QCheckBox::stateChanged,
&OBSBasicTransform::OnControlChanged);
#endif
ui->buttonBox->button(QDialogButtonBox::Close)->setDefault(true);
connect(ui->buttonBox->button(QDialogButtonBox::Reset),

View File

@ -67,10 +67,17 @@ OBSYoutubeActions::OBSYoutubeActions(QWidget *parent, Auth *auth,
[](const QString &link) { QDesktopServices::openUrl(link); });
ui->scheduledTime->setVisible(false);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(ui->checkScheduledLater, &QCheckBox::checkStateChanged, this,
[&](Qt::CheckState state)
#else
connect(ui->checkScheduledLater, &QCheckBox::stateChanged, this,
[&](int state) {
ui->scheduledTime->setVisible(state);
if (state) {
[&](int state)
#endif
{
const bool checked = (state == Qt::Checked);
ui->scheduledTime->setVisible(checked);
if (checked) {
ui->checkAutoStart->setVisible(true);
ui->checkAutoStop->setVisible(true);
ui->helpAutoStartStop->setVisible(true);