本页内容

QDateEdit Class

QDateEdit 类提供了一个基于QDateTimeEdit 控件的日期编辑控件。更多内容...

头文件: #include <QDateEdit>
CMake: find_package(Qt6 REQUIRED COMPONENTS Widgets)
target_link_libraries(mytarget PRIVATE Qt6::Widgets)
qmake: QT += widgets
继承自: QDateTimeEdit

公共函数

QDateEdit(QWidget *parent = nullptr)
QDateEdit(QDate date, QWidget *parent = nullptr)
virtual ~QDateEdit()

详细说明

可编辑的日期

QDateEdit 提供的许多属性与函数都是在 `QDateTimeEdit` 中实现的。以下是该类的相关属性:

  • date 保存控件显示的日期。
  • minimumDate 定义用户可设置的最小(最早)日期。
  • maximumDate 定义用户可设置的最大(最晚)日期。
  • displayFormat 包含一个字符串,用于格式化控件中显示的日期。

另请参阅 QTimeEdit 和QDateTimeEdit 。

成员函数文档

[explicit] QDateEdit::QDateEdit(QWidget *parent = nullptr)

使用parent 构建一个空的日期编辑器。

[explicit] QDateEdit::QDateEdit(QDate date, QWidget *parent = nullptr)

创建一个带有parent 的空日期编辑器。日期设置为date 。

[virtual noexcept] QDateEdit::~QDateEdit()

析构函数。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.