Fix deprecation warnings

This commit is contained in:
Gavin MacGregor
2024-12-29 18:24:37 +00:00
parent dfbfd47191
commit 568469d41e
5 changed files with 45 additions and 0 deletions

View File

@@ -68,10 +68,18 @@ PageComposeLinksDockWidget::PageComposeLinksDockWidget(TeletextWidget *parent):
// Required at which Levels
m_composeLinkLevelCheckbox[i][0] = new QCheckBox(this);
x27Layout->addWidget(m_composeLinkLevelCheckbox[i][0], i+2, 1, 1, 1);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_composeLinkLevelCheckbox[i][0], &QCheckBox::checkStateChanged, [=](bool active) { m_parentMainWidget->document()->currentSubPage()->setComposeLinkLevel2p5(i, active); });
#else
connect(m_composeLinkLevelCheckbox[i][0], &QCheckBox::stateChanged, [=](bool active) { m_parentMainWidget->document()->currentSubPage()->setComposeLinkLevel2p5(i, active); });
#endif
m_composeLinkLevelCheckbox[i][1] = new QCheckBox(this);
x27Layout->addWidget(m_composeLinkLevelCheckbox[i][1], i+2, 2, 1, 1);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_composeLinkLevelCheckbox[i][1], &QCheckBox::checkStateChanged, [=](bool active) { m_parentMainWidget->document()->currentSubPage()->setComposeLinkLevel3p5(i, active); });
#else
connect(m_composeLinkLevelCheckbox[i][1], &QCheckBox::stateChanged, [=](bool active) { m_parentMainWidget->document()->currentSubPage()->setComposeLinkLevel3p5(i, active); });
#endif
} else {
// Selectable link functions for Level 3.5
m_composeLinkFunctionComboBox[i-4] = new QComboBox;

View File

@@ -71,7 +71,11 @@ PageEnhancementsDockWidget::PageEnhancementsDockWidget(TeletextWidget *parent):
// Black background colour substitution
m_blackBackgroundSubstAct = new QCheckBox("Black background colour substitution");
colourLayout->addWidget(m_blackBackgroundSubstAct, 3, 0, 1, 2, Qt::AlignTop);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_blackBackgroundSubstAct, &QCheckBox::checkStateChanged, [=](int state){ m_parentMainWidget->document()->undoStack()->push(new SetBlackBackgroundSubstCommand(m_parentMainWidget->document(), state)); });
#else
connect(m_blackBackgroundSubstAct, &QCheckBox::stateChanged, [=](int state){ m_parentMainWidget->document()->undoStack()->push(new SetBlackBackgroundSubstCommand(m_parentMainWidget->document(), state)); });
#endif
// Add group box to the main layout
colourGroupBox->setLayout(colourLayout);
@@ -98,7 +102,11 @@ PageEnhancementsDockWidget::PageEnhancementsDockWidget(TeletextWidget *parent):
// Side panels status
m_sidePanelStatusAct = new QCheckBox("Side panels at level 3.5 only");
sidePanelsLayout->addWidget(m_sidePanelStatusAct, 2, 0, 1, 2, Qt::AlignTop);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_sidePanelStatusAct, &QCheckBox::checkStateChanged, m_parentMainWidget, &TeletextWidget::setSidePanelAtL35Only);
#else
connect(m_sidePanelStatusAct, &QCheckBox::stateChanged, m_parentMainWidget, &TeletextWidget::setSidePanelAtL35Only);
#endif
// Add group box to the main layout
sidePanelsGroupBox->setLayout(sidePanelsLayout);

View File

@@ -104,7 +104,11 @@ PageOptionsDockWidget::PageOptionsDockWidget(TeletextWidget *parent): QDockWidge
m_controlBitsAct[i] = new QCheckBox(controlBitsLabel[i]);
subPageOptionsLayout->addWidget(m_controlBitsAct[i]);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_controlBitsAct[i], &QCheckBox::checkStateChanged, [=](bool active) { m_parentMainWidget->setControlBit(i, active); });
#else
connect(m_controlBitsAct[i], &QCheckBox::stateChanged, [=](bool active) { m_parentMainWidget->setControlBit(i, active); });
#endif
}
// Region and language

View File

@@ -65,7 +65,11 @@ PaletteDockWidget::PaletteDockWidget(TeletextWidget *parent): QDockWidget(parent
m_showHexValuesCheckBox = new QCheckBox(tr("Show colour hex values"));
paletteGridLayout->addWidget(m_showHexValuesCheckBox, 5, 1, 1, 8);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_showHexValuesCheckBox, &QCheckBox::checkStateChanged, this, &PaletteDockWidget::updateAllColourButtons);
#else
connect(m_showHexValuesCheckBox, &QCheckBox::stateChanged, this, &PaletteDockWidget::updateAllColourButtons);
#endif
paletteGridWidget->setLayout(paletteGridLayout);
this->setWidget(paletteGridWidget);

View File

@@ -208,7 +208,11 @@ X26DockWidget::X26DockWidget(TeletextWidget *parent): QDockWidget(parent)
x26Layout->addLayout(tripletSelectLayout);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(rawOrCookedCheckBox, &QCheckBox::checkStateChanged,[=](const int value) { m_rawOrCookedStackedLayout->setCurrentIndex(value == 2); } );
#else
connect(rawOrCookedCheckBox, &QCheckBox::stateChanged,[=](const int value) { m_rawOrCookedStackedLayout->setCurrentIndex(value == 2); } );
#endif
// Widgets that alter the parameters of triplets which will all be stacked
@@ -280,10 +284,17 @@ X26DockWidget::X26DockWidget(TeletextWidget *parent): QDockWidget(parent)
displayAttributesLayout->addWidget(m_displayAttributeConcealCheckBox);
displayAttributesLayout->addWidget(m_displayAttributeInvertCheckBox);
displayAttributesLayout->addWidget(m_displayAttributeUnderlineCheckBox);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_displayAttributeBoxingCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+2); } );
connect(m_displayAttributeConcealCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+3); } );
connect(m_displayAttributeInvertCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+4); } );
connect(m_displayAttributeUnderlineCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+5); } );
#else
connect(m_displayAttributeBoxingCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+2); } );
connect(m_displayAttributeConcealCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+3); } );
connect(m_displayAttributeInvertCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+4); } );
connect(m_displayAttributeUnderlineCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+5); } );
#endif
// Index 5 - Invoke Object
QHBoxLayout *invokeObjectLayout = new QHBoxLayout;
@@ -422,9 +433,15 @@ X26DockWidget::X26DockWidget(TeletextWidget *parent): QDockWidget(parent)
fontStyleLayout->addWidget(m_fontStyleProportionalCheckBox);
fontStyleLayout->addWidget(m_fontStyleBoldCheckBox);
fontStyleLayout->addWidget(m_fontStyleItalicCheckBox);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_fontStyleProportionalCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+1); } );
connect(m_fontStyleBoldCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+2);; } );
connect(m_fontStyleItalicCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+3); } );
#else
connect(m_fontStyleProportionalCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+1); } );
connect(m_fontStyleBoldCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+2);; } );
connect(m_fontStyleItalicCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget((value == 2), Qt::UserRole+3); } );
#endif
m_fontStyleRowsSpinBox = new QSpinBox;
m_fontStyleRowsSpinBox->setRange(0, 7);
fontStyleLayout->addWidget(m_fontStyleRowsSpinBox);
@@ -454,7 +471,11 @@ X26DockWidget::X26DockWidget(TeletextWidget *parent): QDockWidget(parent)
m_terminationMarkerMoreFollowsCheckBox = new QCheckBox(tr("Objects follow"));
terminationMarkerLayout->addWidget(m_terminationMarkerMoreFollowsCheckBox);
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
connect(m_terminationMarkerMoreFollowsCheckBox, &QCheckBox::checkStateChanged, this, [=](const int value) { updateModelFromCookedWidget(value != 2, Qt::UserRole+2); } );
#else
connect(m_terminationMarkerMoreFollowsCheckBox, &QCheckBox::stateChanged, this, [=](const int value) { updateModelFromCookedWidget(value != 2, Qt::UserRole+2); } );
#endif
// Stack all the triplet parameter layouts together