Moved out PasswordInput to separate module.

This commit is contained in:
23rd 2023-08-31 14:20:20 +03:00
parent 4389f17120
commit 225380044e
5 changed files with 49 additions and 15 deletions

View file

@ -202,6 +202,8 @@ PRIVATE
ui/widgets/input_fields.h ui/widgets/input_fields.h
ui/widgets/labels.cpp ui/widgets/labels.cpp
ui/widgets/labels.h ui/widgets/labels.h
ui/widgets/fields/password_input.cpp
ui/widgets/fields/password_input.h
ui/widgets/fields/time_part_input.cpp ui/widgets/fields/time_part_input.cpp
ui/widgets/fields/time_part_input.h ui/widgets/fields/time_part_input.h
ui/widgets/menu/menu.cpp ui/widgets/menu/menu.cpp

View file

@ -0,0 +1,20 @@
// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/blob/master/LEGAL
//
#include "ui/widgets/fields/password_input.h"
namespace Ui {
PasswordInput::PasswordInput(
QWidget *parent,
const style::InputField &st,
rpl::producer<QString> placeholder,
const QString &val)
: MaskedInputField(parent, st, std::move(placeholder), val) {
QLineEdit::setEchoMode(QLineEdit::Password);
}
} // namespace Ui

View file

@ -0,0 +1,27 @@
// This file is part of Desktop App Toolkit,
// a set of libraries for developing nice desktop applications.
//
// For license and copyright information please follow this link:
// https://github.com/desktop-app/legal/blob/master/LEGAL
//
#pragma once
#include "ui/widgets/input_fields.h"
namespace style {
struct InputField;
} // namespace style
namespace Ui {
class PasswordInput final : public MaskedInputField {
public:
PasswordInput(
QWidget *parent,
const style::InputField &st,
rpl::producer<QString> placeholder = nullptr,
const QString &val = QString());
};
} // namespace Ui

View file

@ -4349,15 +4349,6 @@ void MaskedInputField::onCursorPositionChanged(int oldPosition, int position) {
_oldcursor = position; _oldcursor = position;
} }
PasswordInput::PasswordInput(
QWidget *parent,
const style::InputField &st,
rpl::producer<QString> placeholder,
const QString &val)
: MaskedInputField(parent, st, std::move(placeholder), val) {
setEchoMode(QLineEdit::Password);
}
NumberInput::NumberInput( NumberInput::NumberInput(
QWidget *parent, QWidget *parent,
const style::InputField &st, const style::InputField &st,

View file

@ -718,12 +718,6 @@ private:
}; };
class PasswordInput : public MaskedInputField {
public:
PasswordInput(QWidget *parent, const style::InputField &st, rpl::producer<QString> placeholder = nullptr, const QString &val = QString());
};
class NumberInput : public MaskedInputField { class NumberInput : public MaskedInputField {
public: public:
NumberInput( NumberInput(