[partition] Deal with deprecations in QCheckBox

This commit is contained in:
Adriaan de Groot 2024-12-03 14:26:26 +01:00
parent 20e6d1d66c
commit b5533caece
2 changed files with 11 additions and 8 deletions

View File

@ -60,7 +60,8 @@ EncryptWidget::EncryptWidget( QWidget* parent )
m_ui->m_encryptionUnsupportedLabel->show(); 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_passphraseLineEdit, &QLineEdit::textEdited, this, &EncryptWidget::onPassphraseEdited );
connect( m_ui->m_confirmLineEdit, &QLineEdit::textEdited, this, &EncryptWidget::onPassphraseEdited ); connect( m_ui->m_confirmLineEdit, &QLineEdit::textEdited, this, &EncryptWidget::onPassphraseEdited );
@ -203,12 +204,12 @@ EncryptWidget::onPassphraseEdited()
} }
void void
EncryptWidget::onCheckBoxStateChanged( int checked ) EncryptWidget::onCheckBoxStateChanged( Calamares::checkBoxStateType checked )
{ {
// @p checked is a Qt::CheckState, 0 is "unchecked" and 2 is "checked" const bool visible = ( checked != Calamares::checkBoxUncheckedValue );
m_ui->m_passphraseLineEdit->setVisible( checked ); m_ui->m_passphraseLineEdit->setVisible( visible );
m_ui->m_confirmLineEdit->setVisible( checked ); m_ui->m_confirmLineEdit->setVisible( visible );
m_ui->m_iconLabel->setVisible( checked ); m_ui->m_iconLabel->setVisible( visible );
m_ui->m_passphraseLineEdit->clear(); m_ui->m_passphraseLineEdit->clear();
m_ui->m_confirmLineEdit->clear(); m_ui->m_confirmLineEdit->clear();
m_ui->m_iconLabel->clear(); m_ui->m_iconLabel->clear();

View File

@ -13,6 +13,8 @@
#ifndef ENCRYPTWIDGET_H #ifndef ENCRYPTWIDGET_H
#define ENCRYPTWIDGET_H #define ENCRYPTWIDGET_H
#include "compat/CheckBox.h"
#include <QWidget> #include <QWidget>
#include <kpmcore/fs/filesystem.h> #include <kpmcore/fs/filesystem.h>
@ -59,7 +61,7 @@ signals:
private: private:
void updateState( const bool notify = true ); void updateState( const bool notify = true );
void onPassphraseEdited(); void onPassphraseEdited();
void onCheckBoxStateChanged( int checked ); void onCheckBoxStateChanged( Calamares::checkBoxStateType checked );
Ui::EncryptWidget* m_ui; Ui::EncryptWidget* m_ui;
Encryption m_state; Encryption m_state;