From b5533caece41177a771e501beaf92e9836814a1b Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 3 Dec 2024 14:26:26 +0100 Subject: [PATCH] [partition] Deal with deprecations in QCheckBox --- src/modules/partition/gui/EncryptWidget.cpp | 13 +++++++------ src/modules/partition/gui/EncryptWidget.h | 6 ++++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/modules/partition/gui/EncryptWidget.cpp b/src/modules/partition/gui/EncryptWidget.cpp index 93fc852ba..58c1f5143 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -60,7 +60,8 @@ EncryptWidget::EncryptWidget( QWidget* parent ) m_ui->m_encryptionUnsupportedLabel->show(); } - connect( m_ui->m_encryptCheckBox, &QCheckBox::stateChanged, this, &EncryptWidget::onCheckBoxStateChanged ); + connect( + m_ui->m_encryptCheckBox, Calamares::checkBoxStateChangedSignal, this, &EncryptWidget::onCheckBoxStateChanged ); connect( m_ui->m_passphraseLineEdit, &QLineEdit::textEdited, this, &EncryptWidget::onPassphraseEdited ); connect( m_ui->m_confirmLineEdit, &QLineEdit::textEdited, this, &EncryptWidget::onPassphraseEdited ); @@ -203,12 +204,12 @@ EncryptWidget::onPassphraseEdited() } void -EncryptWidget::onCheckBoxStateChanged( int checked ) +EncryptWidget::onCheckBoxStateChanged( Calamares::checkBoxStateType checked ) { - // @p checked is a Qt::CheckState, 0 is "unchecked" and 2 is "checked" - m_ui->m_passphraseLineEdit->setVisible( checked ); - m_ui->m_confirmLineEdit->setVisible( checked ); - m_ui->m_iconLabel->setVisible( checked ); + const bool visible = ( checked != Calamares::checkBoxUncheckedValue ); + m_ui->m_passphraseLineEdit->setVisible( visible ); + m_ui->m_confirmLineEdit->setVisible( visible ); + m_ui->m_iconLabel->setVisible( visible ); m_ui->m_passphraseLineEdit->clear(); m_ui->m_confirmLineEdit->clear(); m_ui->m_iconLabel->clear(); diff --git a/src/modules/partition/gui/EncryptWidget.h b/src/modules/partition/gui/EncryptWidget.h index c7cc23daa..6f3db7532 100644 --- a/src/modules/partition/gui/EncryptWidget.h +++ b/src/modules/partition/gui/EncryptWidget.h @@ -13,6 +13,8 @@ #ifndef ENCRYPTWIDGET_H #define ENCRYPTWIDGET_H +#include "compat/CheckBox.h" + #include #include @@ -36,7 +38,7 @@ public: explicit EncryptWidget( QWidget* parent = nullptr ); - void setEncryptionCheckbox( bool preCheckEncrypt = false); + void setEncryptionCheckbox( bool preCheckEncrypt = false ); void reset( bool checkVisible = true ); bool isEncryptionCheckboxChecked(); @@ -59,7 +61,7 @@ signals: private: void updateState( const bool notify = true ); void onPassphraseEdited(); - void onCheckBoxStateChanged( int checked ); + void onCheckBoxStateChanged( Calamares::checkBoxStateType checked ); Ui::EncryptWidget* m_ui; Encryption m_state;