date_time ========= .. py:module:: qfluentwidgets.components.date_time .. toctree:: :titlesonly: :maxdepth: 1 calendar_picker/index.rst calendar_view/index.rst date_picker/index.rst fast_calendar_view/index.rst picker_base/index.rst time_picker/index.rst Package Contents ---------------- .. autoapisummary:: qfluentwidgets.components.date_time.CalendarPicker qfluentwidgets.components.date_time.FastCalendarPicker qfluentwidgets.components.date_time.DatePickerBase qfluentwidgets.components.date_time.DatePicker qfluentwidgets.components.date_time.ZhDatePicker qfluentwidgets.components.date_time.PickerBase qfluentwidgets.components.date_time.PickerPanel qfluentwidgets.components.date_time.PickerColumnFormatter qfluentwidgets.components.date_time.TimePicker qfluentwidgets.components.date_time.AMTimePicker .. py:class:: CalendarPicker(parent=None) Bases: :py:obj:`PyQt5.QtWidgets.QPushButton` Calendar picker .. py:attribute:: dateChanged .. py:method:: getDate() .. py:method:: setDate(date: PyQt5.QtCore.QDate) set the selected date .. py:method:: reset() reset date .. py:method:: getDateFormat() .. py:method:: setDateFormat(format: Union[PyQt5.QtCore.Qt.DateFormat, str]) .. py:method:: isRestEnabled() .. py:method:: setResetEnabled(isEnabled: bool) set the visibility of reset button .. py:method:: paintEvent(e) .. py:attribute:: date .. py:attribute:: dateFormat .. py:class:: FastCalendarPicker(parent=None) Bases: :py:obj:`CalendarPicker` Pro calendar picker .. py:attribute:: flyoutAnimationType .. py:method:: setFlyoutAnimationType(aniType: qfluentwidgets.components.widgets.flyout.FlyoutAnimationType) .. py:class:: DatePickerBase(parent=None) Bases: :py:obj:`qfluentwidgets.components.date_time.picker_base.PickerBase` Date picker base class .. py:attribute:: dateChanged .. py:attribute:: calendar .. py:method:: getDate() .. py:method:: setDate(date: PyQt5.QtCore.QDate) :abstractmethod: set current date .. py:method:: setYearFormatter(formatter: qfluentwidgets.components.date_time.picker_base.PickerColumnFormatter) .. py:method:: setMonthFormatter(formatter: qfluentwidgets.components.date_time.picker_base.PickerColumnFormatter) .. py:method:: setDayFormatter(formatter: qfluentwidgets.components.date_time.picker_base.PickerColumnFormatter) .. py:method:: yearFormatter() .. py:method:: dayFormatter() .. py:method:: monthFormatter() .. py:method:: reset() Reset date .. py:class:: DatePicker(parent=None, format=MM_DD_YYYY, isMonthTight=True) Bases: :py:obj:`DatePickerBase` Date picker .. py:attribute:: MM_DD_YYYY :value: 0 .. py:attribute:: YYYY_MM_DD :value: 1 .. py:attribute:: MONTH .. py:attribute:: YEAR .. py:attribute:: DAY .. py:attribute:: isMonthTight :value: True .. py:method:: setDateFormat(format: int) set the format of date Parameters ---------- format: int the format of date, could be `DatePicker.MM_DD_YYYY` or `DatePicker.YYYY_MM_DD` .. py:method:: panelInitialValue() initial value of panel .. py:method:: setMonthTight(isTight: bool) set whether the month column is tight .. py:method:: getDate() .. py:method:: setDate(date: PyQt5.QtCore.QDate) set current date .. py:attribute:: date .. py:class:: ZhDatePicker(parent=None) Bases: :py:obj:`DatePicker` Chinese date picker .. py:attribute:: MONTH :value: '月' .. py:attribute:: YEAR :value: '年' .. py:attribute:: DAY :value: '日' .. py:class:: PickerBase(parent=None) Bases: :py:obj:`PyQt5.QtWidgets.QPushButton` Picker base class .. py:attribute:: columns :type: List[PickerColumnButton] :value: [] .. py:attribute:: lightSelectedBackgroundColor .. py:attribute:: darkSelectedBackgroundColor .. py:attribute:: hBoxLayout .. py:method:: setSelectedBackgroundColor(light, dark) set the background color of selected row .. py:method:: addColumn(name: str, items: Iterable, width: int, align=Qt.AlignCenter, formatter: PickerColumnFormatter = None) add column Parameters ---------- name: str the name of column items: Iterable the items of column width: int the width of column align: Qt.AlignmentFlag the text alignment of button formatter: PickerColumnFormatter the formatter of column .. py:method:: setColumnAlignment(index: int, align=Qt.AlignCenter) set the text alignment of specified column .. py:method:: setColumnWidth(index: int, width: int) set the width of specified column .. py:method:: setColumnTight(index: int) make the specified column to be tight .. py:method:: setColumnVisible(index: int, isVisible: bool) set the text alignment of specified column .. py:method:: value() .. py:method:: initialValue() .. py:method:: setColumnValue(index: int, value) .. py:method:: setColumnInitialValue(index: int, value) .. py:method:: setColumnFormatter(index: int, formatter: PickerColumnFormatter) .. py:method:: setColumnItems(index: int, items: Iterable) .. py:method:: encodeValue(index: int, value) convert original value to formatted value .. py:method:: decodeValue(index: int, value) convert formatted value to origin value .. py:method:: setColumn(index: int, name: str, items: Iterable, width: int, align=Qt.AlignCenter) set column Parameters ---------- index: int the index of column name: str the name of column items: Iterable the items of column width: int the width of column align: Qt.AlignmentFlag the text alignment of button .. py:method:: clearColumns() clear columns .. py:method:: enterEvent(e) .. py:method:: leaveEvent(e) .. py:method:: mousePressEvent(e) .. py:method:: mouseReleaseEvent(e) .. py:method:: panelInitialValue() initial value of panel .. py:method:: setScrollButtonRepeatEnabled(isEnabled: bool) set whether to enable scroll button auto repeat .. py:method:: reset() .. py:method:: isRestEnabled() .. py:method:: setResetEnabled(isEnabled: bool) set the visibility of reset button .. py:class:: PickerPanel(parent=None) Bases: :py:obj:`PyQt5.QtWidgets.QWidget` picker panel .. py:attribute:: confirmed .. py:attribute:: resetted .. py:attribute:: columnValueChanged .. py:attribute:: itemHeight :value: 37 .. py:attribute:: listWidgets :type: List[qfluentwidgets.components.widgets.cycle_list_widget.CycleListWidget] :value: [] .. py:attribute:: view .. py:attribute:: itemMaskWidget .. py:attribute:: hSeparatorWidget .. py:attribute:: yesButton .. py:attribute:: resetButton .. py:attribute:: cancelButton .. py:attribute:: hBoxLayout .. py:attribute:: listLayout .. py:attribute:: buttonLayout .. py:attribute:: vBoxLayout .. py:attribute:: scrollButtonRepeatEnabled :value: True .. py:method:: setShadowEffect(blurRadius=30, offset=(0, 8), color=QColor(0, 0, 0, 30)) add shadow to dialog .. py:method:: setResetEnabled(isEnabled: bool) set the visibility of reset button .. py:method:: setScrollButtonRepeatEnabled(isEnabled: bool) set whether to enable scroll button auto repeat .. py:method:: setSelectedBackgroundColor(light, dark) .. py:method:: isResetEnabled() .. py:method:: addColumn(items: Iterable, width: int, align=Qt.AlignCenter) add one column to view Parameters ---------- items: Iterable[Any] the items to be added width: int the width of item align: Qt.AlignmentFlag the text alignment of item .. py:method:: resizeEvent(e) .. py:method:: value() return the value of columns .. py:method:: setValue(value: list) set the value of columns .. py:method:: columnValue(index: int) -> str return the value of specified column .. py:method:: setColumnValue(index: int, value: str) set the value of specified column .. py:method:: column(index: int) return the list widget of specified column .. py:method:: exec(pos, ani=True) show panel Parameters ---------- pos: QPoint pop-up position ani: bool Whether to show pop-up animation .. py:class:: PickerColumnFormatter Bases: :py:obj:`PyQt5.QtCore.QObject` Picker column formatter .. py:method:: encode(value) convert original value to formatted value .. py:method:: decode(value: str) convert formatted value to original value .. py:class:: TimePicker(parent=None, showSeconds=False) Bases: :py:obj:`TimePickerBase` 24 hours time picker .. py:method:: setTime(time) set current time Parameters ---------- time: QTime current time .. py:method:: setSecondVisible(isVisible: bool) set the visibility of seconds column .. py:method:: panelInitialValue() initial value of panel .. py:method:: getTime() .. py:method:: isSecondVisible() .. py:attribute:: time .. py:attribute:: secondVisible .. py:class:: AMTimePicker(parent=None, showSeconds=False) Bases: :py:obj:`TimePickerBase` AM/PM time picker .. py:attribute:: AM .. py:attribute:: PM .. py:method:: setSecondVisible(isVisible: bool) set the visibility of seconds column .. py:method:: setTime(time) set current time Parameters ---------- time: QTime current time .. py:method:: panelInitialValue() initial value of panel .. py:method:: getTime() .. py:method:: isSecondVisible() .. py:attribute:: time .. py:attribute:: secondVisible