diff --git a/docs/images/dbaseline.png b/docs/images/dbaseline.png new file mode 100644 index 000000000..847c06a24 Binary files /dev/null and b/docs/images/dbaseline.png differ diff --git a/docs/widgets/dbaseline.zh_CN.dox b/docs/widgets/dbaseline.zh_CN.dox new file mode 100644 index 000000000..22fdf0714 --- /dev/null +++ b/docs/widgets/dbaseline.zh_CN.dox @@ -0,0 +1,90 @@ +/*! +@~chinese +@file dbaseline.h +@ingroup dtkwidget + +@class Dtk::Widget::DBaseLine +@brief 可以使用 DBaseLine 类快速创建具有位于左右两侧的两个控件的行控件. +@details +##示例1 +#### DHeaderLine控件 +DBaseLine 提供一个固定高度的控件,包含分别位于左侧和右侧的两个可供显示的控件。 +可用于构建固定行高并需要自定义左右控件的控件,比如上方导航栏等。如 DHeaderLine 即使用 DBaseLine +构建了一个带有文字标题和可选内容控件的控件: +@image html DHeaderLine.png +@sa DHeaderLine +##示例2 +### 示例代码 +#### main.cpp +```cpp +#include +#include +#include + +DWIDGET_USE_NAMESPACE + +int main(int argc, char *argv[]) +{ + DApplication app(argc, argv); + + // 创建主窗口 + QWidget mainWindow; + mainWindow.setWindowTitle("DBaseLine Example"); + + // 创建DBaseLine控件 + DBaseLine baseLine(&mainWindow); + + // 创建左侧控件 + QLabel *leftLabel = new QLabel("Left Widget"); + baseLine.setLeftContent(leftLabel); + + // 创建右侧控件 + QLabel *rightLabel = new QLabel("Right Widget"); + baseLine.setRightContent(rightLabel); + + // 设置外边距 + baseLine.setLeftMargin(10); + baseLine.setRightMargin(10); + + // 将DBaseLine添加到主窗口 + QVBoxLayout *layout = new QVBoxLayout(&mainWindow); + layout->addWidget(&baseLine); + + mainWindow.show(); + + return app.exec(); +} +``` +### 示例图片 +@image html dbaseline.png + +@fn void DBaseLine::setLeftContent(QWidget *content) +@param[in] content 控件 +@brief 设置左侧内容控件 + +@fn void DBaseLine::setRightContent(QWidget *content) +@param[in] content 控件 +@brief 设置右侧内容控件 + +@fn QBoxLayout *DBaseLine::leftLayout() +@brief 获取左侧 QBoxLayout + +@fn QBoxLayout *DBaseLine::rightLayout() +@brief 获取右侧 QBoxLayout + +@fn void DBaseLine::setLeftMargin(int margin) +@brief 设置左侧外边距 +@param[in] margin 边距 + +@fn void DBaseLine::setRightMargin(int margin) +@brief 设置右侧外边距 +@param[in] margin 边距 + +@fn int DBaseLine::leftMargin() const +@brief 获取左侧外边距 + +@fn int DBaseLine::rightMargin() const +@brief 右侧外侧外边距 +*/ + + diff --git a/src/widgets/dbaseline.cpp b/src/widgets/dbaseline.cpp index e0b876264..813e473c0 100644 --- a/src/widgets/dbaseline.cpp +++ b/src/widgets/dbaseline.cpp @@ -8,18 +8,16 @@ DWIDGET_BEGIN_NAMESPACE /*! - \class Dtk::Widget::DBaseLine - \inmodule dtkwidget - - \brief 可以使用 DBaseLine 类快速创建具有位于左右两侧的两个控件的行控件. - \brief Use DBaseLine to create a widget for display inline widget. - - DBaseLine 提供一个固定高度的控件,包含分别位于左侧和右侧的两个可供显示的控件。 - DBaseLine 可用于构建固定行高并需要自定义左右控件的控件,比如上方导航栏等。如 DHeaderLine 即使用 DBaseLine - 构建了一个带有文字标题和可选内容控件的控件。 - DBaseLine provide a fixed height inline widget with two widgets for displaying related stuff. - - \sa DHeaderLine +@~english + @class Dtk::Widget::DBaseLine + @ingroup dtkwidget + + @brief Use the DBaseLine class to quickly create a row widget with two controls positioned on the left and right sides. +The DBaseLine class provides a fixed-height widget that contains two displayable controls positioned on the left and +right sides, respectively. DBaseLine can be used to build widgets with a fixed row height and custom left and right +controls, such as a top navigation bar.For example, DHeaderLine utilizes DBaseLine to construct a widget with a text +title and an optional content control. + @sa DHeaderLine */ DBaseLine::DBaseLine(QWidget *parent) : QLabel(parent) @@ -42,8 +40,9 @@ DBaseLine::DBaseLine(QWidget *parent) : QLabel(parent) } /*! - \brief set left \a content widget - \brief 设置左侧内容控件 +@~english + @brief set left widget + @param[in] content widget */ void DBaseLine::setLeftContent(QWidget *content) { @@ -56,8 +55,9 @@ void DBaseLine::setLeftContent(QWidget *content) } /*! - \brief set right \a content widget - \brief 设置右侧内容控件 +@~english + @brief set right widget + @param[in] content widget */ void DBaseLine::setRightContent(QWidget *content) { @@ -70,8 +70,8 @@ void DBaseLine::setRightContent(QWidget *content) } /*! - \brief get left layout - \brief 获取左侧 QBoxLayout +@~english + @brief get left layout */ QBoxLayout *DBaseLine::leftLayout() { @@ -79,8 +79,8 @@ QBoxLayout *DBaseLine::leftLayout() } /*! - \brief get right layout - \brief 获取右侧 QBoxLayout +@~english + @brief get right layout */ QBoxLayout *DBaseLine::rightLayout() { @@ -88,8 +88,9 @@ QBoxLayout *DBaseLine::rightLayout() } /*! - \brief set left margin - \brief 设置左侧外补 \a margin 边距 +@~english + @brief set left margin + @param[in] margin the length of margin */ void DBaseLine::setLeftMargin(int margin) { @@ -98,8 +99,9 @@ void DBaseLine::setLeftMargin(int margin) } /*! - \brief set right margin - \brief 设置右侧外补 \a margin 边距 +@~english + @brief set right margin + @param[in] margin the length of margin */ void DBaseLine::setRightMargin(int margin) { @@ -108,8 +110,8 @@ void DBaseLine::setRightMargin(int margin) } /*! - \brief get left margin - \brief 获取左侧外边距 +@~english + @brief get left margin */ int DBaseLine::leftMargin() const { @@ -117,8 +119,8 @@ int DBaseLine::leftMargin() const } /*! - \brief get right margin - \brief 右侧外侧外边距 +@~english + @brief get right margin */ int DBaseLine::rightMargin() const {