本文整理汇总了Python中PyQt5.QtCore.QDate类的典型用法代码示例。如果您正苦于以下问题:Python QDate类的具体用法?Python QDate怎么用?Python QDate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: start_settings
def start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addDays(-10))
self.de_date_to.setDate(QDate.currentDate())
self.tableWidget.horizontalHeader().resizeSection(0, 65)
self.tableWidget.horizontalHeader().resizeSection(1, 30)
self.tableWidget.horizontalHeader().resizeSection(2, 60)
示例2: start_settings
def start_settings(self):
self.de_date_in.setDate(QDate.currentDate().addMonths(-1))
self.de_date_from.setDate(QDate.currentDate())
self.table_widget.horizontalHeader().resizeSection(0, 65)
self.table_widget.horizontalHeader().resizeSection(1, 65)
self.table_widget.horizontalHeader().resizeSection(2, 35)
self.table_widget.horizontalHeader().resizeSection(3, 155)
self.table_widget.horizontalHeader().resizeSection(4, 35)
self.table_widget.horizontalHeader().resizeSection(5, 35)
self.table_widget.horizontalHeader().resizeSection(6, 40)
self.table_widget.horizontalHeader().resizeSection(7, 100)
self.table_widget.horizontalHeader().resizeSection(8, 70)
self.table_widget.horizontalHeader().resizeSection(9, 70)
self.table_widget.horizontalHeader().resizeSection(10, 70)
self.table_widget.horizontalHeader().resizeSection(11, 70)
self.table_widget.horizontalHeader().resizeSection(12, 70)
self.table_widget.horizontalHeader().resizeSection(13, 70)
self.table_widget.horizontalHeader().resizeSection(14, 70)
self.table_widget.horizontalHeader().resizeSection(15, 70)
self.table_widget.horizontalHeader().resizeSection(16, 70)
self.table_widget.horizontalHeader().resizeSection(17, 70)
self.table_widget.horizontalHeader().resizeSection(18, 70)
self.table_widget.horizontalHeader().resizeSection(19, 70)
self.table_widget.horizontalHeader().resizeSection(20, 70)
示例3: __init__
def __init__(self):
super(MainWindow, self).__init__()
# setupUi というメソッドが定義されているので実行する
# これで設置したウィジェットなどがインスタンス化される
self.setupUi(self)
# 継承したので self.名前 でアクセスできる
self.setWindowTitle("AgeInDays") # ウィンドウタイトル
# 操作と関数のひも付け
self.pushButton_Go.clicked.connect(self.calculate)
self.pushButton_Clear.clicked.connect(self.textBrowser.clear)
self.change_mode.activated.connect(self.target_mode_change)
self.switch_target_age.activated.connect(self.target_mode_change)
self.switch_target_range.activated.connect(self.target_mode_change)
# 日付入力に今日の日付を挿入
self.input_research_date.setDate(QDate.currentDate())
self.input_birthday.setDate(QDate.currentDate())
# ラジオボタンの初期設定とカレンダーにひも付け
self.switch_birthday.toggled.connect(self.connect_calendar) # ボタングループで判定されるので1つだけ
self.switch_research_date.setChecked(True)
self.switch_birthday.setChecked(False)
# カレンダーのひも付けとUIのデフォルト状態を設定しておく
self.connect_calendar()
self.target_mode_change()
示例4: __setup_log_tab
def __setup_log_tab(self):
self._log_table_view = pd.DataFrame()
self._log_table_model = DataFrameModel(self._log_table_view, copyDataFrame=False, show_index=False)
self._log_table_model.enableEditing(True)
self._log_table_model.dataChanged.connect(self.log_values_changed)
self.log_table.setModel(self._log_table_model)
self.log_table.horizontalHeader().setStretchLastSection(True)
self._log_date = pd.Timestamp.today()
self._log_lift = ''
self._log_unsynced_changes = False
self._log_unsaved_changes = False
self.log_date.setDate(QDate.currentDate())
self.log_cal.setSelectedDate(QDate.currentDate())
self.log_date_changed(pd.Timestamp.today())
self.log_populate_lifts_box()
self.log_populate_table()
self.log_date.dateChanged.connect(self.log_date_selection_changed)
self.log_cal.selectionChanged.connect(self.log_cal_selection_changed)
self.log_add.clicked.connect(self.log_add_entry)
self.log_save.clicked.connect(self.log_sync_changes)
self.log_delete.clicked.connect(self.log_del_row)
示例5: set_start_settings
def set_start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tw_product.horizontalHeader().resizeSection(0, 40)
self.tw_product.horizontalHeader().resizeSection(1, 100)
self.tw_product.horizontalHeader().resizeSection(2, 60)
self.tw_product.horizontalHeader().resizeSection(3, 200)
示例6: checkDeadDateTime
def checkDeadDateTime(self):
print(QDate.currentDate())
print(QTime.currentTime())
datetime=QDateTime(QDate.currentDate(),QTime.currentTime())
if(datetime<=self.deaddatetime):
return True
else:
return False
示例7: set_start_settings
def set_start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tableWidget.horizontalHeader().resizeSection(0, 215)
self.tableWidget.horizontalHeader().resizeSection(1, 80)
self.tableWidget.horizontalHeader().resizeSection(2, 80)
self.tableWidget.horizontalHeader().resizeSection(3, 100)
示例8: start_settings
def start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tw_work.horizontalHeader().resizeSection(0, 110)
self.tw_work.horizontalHeader().resizeSection(1, 110)
self.tw_work.horizontalHeader().resizeSection(2, 70)
self.tw_work.horizontalHeader().resizeSection(3, 70)
self.tw_work.horizontalHeader().resizeSection(4, 70)
示例9: monthsBetweenDates
def monthsBetweenDates(self, fromDate, toDate):
curDate = QDate(fromDate)
months =[]
while curDate < toDate:
months.append(curDate)
curDate = curDate.addMonths(1)
return months
示例10: __initData
def __initData(self):
"""
Private method to (re-)initialize some data.
"""
self.__maxDate = QDate()
self.__minDate = QDate()
self.__filterLogsEnabled = True
self.diff = None
self.__lastRev = 0
示例11: setDateEnd
def setDateEnd(self):
date = self.cal2.selectedDate()
date = date.toPyDate()
self.parent.day_end = datetime.datetime(date.year, date.month, date.day)
self.lbl2.setText(self.parent.day_end.strftime('%d/%m/%Y'))
maxDate_dt = self.parent.day_end - datetime.timedelta(days=1)
maxDate = QDate()
maxDate.setDate(maxDate_dt.year, maxDate_dt.month, maxDate_dt.day)
self.cal1.setMaximumDate(maxDate)
示例12: setDateStart
def setDateStart(self):
date = self.cal1.selectedDate()
date = date.toPyDate()
self.parent.day_start = datetime.datetime(date.year, date.month, date.day)
self.lbl1.setText(self.parent.day_start.strftime('%d/%m/%Y'))
minDate_dt = self.parent.day_start + datetime.timedelta(days=1)
minDate = QDate()
minDate.setDate(minDate_dt.year, minDate_dt.month, minDate_dt.day)
self.cal2.setMinimumDate(minDate)
示例13: start_settings
def start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-3))
self.de_date_to.setDate(QDate.currentDate())
self.tw_pack.horizontalHeader().resizeSection(0, 50)
self.tw_pack.horizontalHeader().resizeSection(1, 50)
self.tw_pack.horizontalHeader().resizeSection(2, 50)
self.tw_pack.horizontalHeader().resizeSection(3, 50)
self.tw_pack.horizontalHeader().resizeSection(4, 80)
self.tw_pack.horizontalHeader().resizeSection(5, 80)
self.tw_pack.horizontalHeader().resizeSection(6, 80)
示例14: set_start_settings
def set_start_settings(self):
self.de_date_from.setDate(QDate.currentDate().addMonths(-1))
self.de_date_to.setDate(QDate.currentDate())
self.tableWidget.horizontalHeader().resizeSection(0, 150)
self.tableWidget.horizontalHeader().resizeSection(1, 60)
self.tableWidget.horizontalHeader().resizeSection(2, 70)
self.tableWidget.horizontalHeader().resizeSection(3, 70)
self.tableWidget.horizontalHeader().resizeSection(4, 90)
self.tableWidget.horizontalHeader().resizeSection(5, 90)
self.tableWidget.horizontalHeader().resizeSection(6, 60)
示例15: MySortFilterProxyModel
class MySortFilterProxyModel(QSortFilterProxyModel):
def __init__(self, parent=None):
super(MySortFilterProxyModel, self).__init__(parent)
self.minDate = QDate()
self.maxDate = QDate()
def setFilterMinimumDate(self, date):
self.minDate = date
self.invalidateFilter()
def filterMinimumDate(self):
return self.minDate
def setFilterMaximumDate(self, date):
self.maxDate = date
self.invalidateFilter()
def filterMaximumDate(self):
return self.maxDate
def filterAcceptsRow(self, sourceRow, sourceParent):
index0 = self.sourceModel().index(sourceRow, 0, sourceParent)
index1 = self.sourceModel().index(sourceRow, 1, sourceParent)
index2 = self.sourceModel().index(sourceRow, 2, sourceParent)
return (
self.filterRegExp().indexIn(self.sourceModel().data(index0)) >= 0
or self.filterRegExp().indexIn(self.sourceModel().data(index1)) >= 0
) and self.dateInRange(self.sourceModel().data(index2))
def lessThan(self, left, right):
leftData = self.sourceModel().data(left)
rightData = self.sourceModel().data(right)
if not isinstance(leftData, QDate):
emailPattern = QRegExp("([\\w\\.]*@[\\w\\.]*)")
if left.column() == 1 and emailPattern.indexIn(leftData) != -1:
leftData = emailPattern.cap(1)
if right.column() == 1 and emailPattern.indexIn(rightData) != -1:
rightData = emailPattern.cap(1)
return leftData < rightData
def dateInRange(self, date):
if isinstance(date, QDateTime):
date = date.date()
return (not self.minDate.isValid() or date >= self.minDate) and (
not self.maxDate.isValid() or date <= self.maxDate
)