Kirigami-addons

passwordhealth.h
1// SPDX-FileCopyrightText: 2025 Carl Schwan <carl@carlschwan.eu>
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <QObject>
7#include <qqmlregistration.h>
8
9/**
10 * @internal Do not use!
11 */
12class PasswordHealth : public QObject
13{
15 QML_ELEMENT
16
17 Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
18 Q_PROPERTY(double entropy READ entropy NOTIFY passwordChanged)
19 Q_PROPERTY(Quality quality READ quality NOTIFY passwordChanged)
20
21public:
22 enum Quality {
23 Bad,
24 Poor,
25 Weak,
26 Good,
27 Excellent,
28 };
29 Q_ENUM(Quality)
30
31 explicit PasswordHealth(QObject *parent = nullptr);
32
33 [[nodiscard]] QString password() const;
34 void setPassword(const QString &password);
35
36 double entropy() const;
37 Quality quality() const;
38
40 void passwordChanged();
41
42private:
43 QString m_password;
44 double m_entropy;
45};
QObject(QObject *parent)
Q_ENUM(...)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:53:19 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.