Skip to content

Commit

Permalink
doc: update docs for dpasswordedit
Browse files Browse the repository at this point in the history
更新dpasswordedit的文档

Log: update docs

Task: deepin-community/coding-quarter#26
  • Loading branch information
homehomehu authored and deepin-bot[bot] committed Jul 3, 2023
1 parent 05b122c commit aa18184
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 21 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,7 @@ qt_lib_dtkwidget.pri
dtkwidget.pc
*.qdoc
CMakeLists.txt.user

# Ignore Doxygen theme files
docs/doxygen-theme/

Binary file added docs/images/dpasswordedit_example1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/dpasswordedit_example2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
29 changes: 26 additions & 3 deletions docs/widgets/dpasswordedit.zh_CN.dox
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,34 @@
@~chinese
@file dpasswordedit.h
@ingroup edit
@class
@brief

@class Dtk::Widget::DPasswordEdit
@brief DPasswordEdit提供了一个让用户输入的密码框.
@details

TODO: 添加类简介、示例代码、示例截图和函数使用说明等
## demo示例
<img src="docs/images/dpasswordedit_example1.png" alt="Example 1" width="700" height="370">
<img src="docs/images/dpasswordedit_example2.png" alt="Example 2" width="700" height="370">

@fn DPasswordEdit::DPasswordEdit(QWidget *parent)
@brief DPasswordEdit的构造函数.
@brief DPasswordEdit::DPasswordEdit 实例化了一个DPasswordEdit.
@param[in] parent 父部件被传递给DLineEdit构造函数.

@property DPasswordEdit::isEchoMode
@brief 该属性会控制用户输入是否可见。若可见,用户输入将直接显示在输入框内;若不可见,用户输入将以点的形式显示.
@sa QLineEdit::EchoMode

@fn void DPasswordEdit::setEchoMode(QLineEdit::EchoMode mode)
@brief 设置回显模式
@sa QLineEdit::EchoMode
@param[in] mode 如果传入的mode与当前回显模式相同,则不执行任何操作;如果传入的mode与当前回显模式不同,函数调用基类DLineEdit的setEchoMode(mode)函数来设置密码编辑框的回显模式.

@fn void DPasswordEdit::setEchoButtonIsVisible(bool visible)
@brief 设置回显模式按钮是否可见
@param[in] visible true则设置回显模式的按钮可见,false则设置回显模式的按钮不可见

@fn bool DPasswordEdit::echoButtonIsVisible() const
@brief 回显模式的按钮是否可见
@return 若返回值为true则回显模式的按钮可见,若返回值为false则回显模式的按钮不可见
*/
43 changes: 25 additions & 18 deletions src/widgets/dpasswordedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,22 @@
DWIDGET_BEGIN_NAMESPACE

/*!
\class Dtk::Widget::DPasswordEdit
@~english
@class Dtk::Widget::DPasswordEdit
\inmodule dtkwidget
\brief DPasswordEdit提供了一个让用户输入的密码框.
\brief The DPasswordEdit class provides a widget to let user input password.
@brief DPasswordEdit provides a password input box for user input.
@brief The DPasswordEdit class provides a widget to let user input password.
*/

/*!
\brief DPasswordEdit的构造函数.
\brief DPasswordEdit::DPasswordEdit constructs an instance of DPasswordEdit.
\a parent is passed to DLineEdit constructor.
@~english
@brief DPasswordEdit constructor.
@brief DPasswordEdit::DPasswordEdit constructs an instance of DPasswordEdit.
@param[in] parent The parent widget passed to DLineEdit constructor.
*/

DPasswordEdit::DPasswordEdit(QWidget *parent)
: DLineEdit(*new DPasswordEditPrivate(this), parent)
{
Expand All @@ -41,23 +44,25 @@ DPasswordEdit::DPasswordEdit(QWidget *parent)
}

/*!
\property DPasswordEdit::isEchoMode
@~english
@property DPasswordEdit::isEchoMode
\brief 该属性会控制用户输入是否可见.
\brief This property holds whether the user input should be displayed directly
@brief This attribute controls the visibility of user input.
@brief This property holds whether the user input should be displayed directly
or show as dots.
\sa QLineEdit::EchoMode
@sa QLineEdit::EchoMode
*/
bool DPasswordEdit::isEchoMode() const
{
return lineEdit()->echoMode() == QLineEdit::Normal;
}

/*!
\brief 设置显示模式
\sa QLineEdit::EchoMode
\a mode
@~english
@brief Setting the model of display.
@sa QLineEdit::EchoMode
@param[in] mode
*/
void DPasswordEdit::setEchoMode(QLineEdit::EchoMode mode)
{
Expand All @@ -79,8 +84,9 @@ void DPasswordEdit::setEchoMode(QLineEdit::EchoMode mode)
}

/*!
\brief DPasswordEdit::setEchoButtonIsVisible 设置输入密码是否可见
\a visible true输入密码可见 false不可见
@~english
@brief DPasswordEdit::setEchoButtonIsVisible Set the visibility of the button of echo mode.
@param[in] visible "true" means the button of echo mode is visible, while "false" means the button of echo mode is not visible.
*/
void DPasswordEdit::setEchoButtonIsVisible(bool visible)
{
Expand All @@ -91,8 +97,9 @@ void DPasswordEdit::setEchoButtonIsVisible(bool visible)
}

/*!
\brief DPasswordEdit::echoButtonIsVisible
\return true输入密码可见 false不可见
@~english
@brief DPasswordEdit::echoButtonIsVisible
@return If "true", the button of echo mode is visible. If "false", the button of echo mode is not visible.
*/
bool DPasswordEdit::echoButtonIsVisible() const
{
Expand Down

0 comments on commit aa18184

Please sign in to comment.