我们从Python开源项目中,提取了以下5个代码示例,用于说明如何使用PyQt4.QtCore.QDate()。
def from_datetime(date): """Return QDate object from datetime.date.""" return QDate(date.year, date.month, date.day)
def to_datetime(qdate): """Return datetime.date object from QDate.""" return date(day=qdate.day(), month=qdate.month(), year=qdate.year())
def showSelectedDate(self, _date): self.date = QtCore.QDate(_date) self.lblDate.setText(str(self.date.day()) + "/" + str(self.date.month()) + "/" + str(self.date.year()))
def onBtnSave(self): _rows = self.ui.tableWidget.rowCount() for _row in range (_rows): _ret = self.ui.tableWidget.item(_row,2).text() if _ret == '?': QtGui.QMessageBox.information(self, 'TMV3', "you have to set the Version", QtGui.QMessageBox.Ok) return _cD = self.ui.tableWidget.cellWidget(_row,3) _ret = _cD.date() if _ret == QtCore.QDate(2000,1,1): QtGui.QMessageBox.information(self, 'TMV3', "you have to set the Creation Date", QtGui.QMessageBox.Ok) return self.saveTLM3() return
def onBtnSave(self): _rows = self.ui.tableWidget.rowCount() for _row in range (_rows): _cb = self.ui.tableWidget.cellWidget(_row,2) _ret = str(_cb.currentText()) if _ret == "": QtGui.QMessageBox.information(self, 'TMV3', "you have to set the new Titles", QtGui.QMessageBox.Ok) return _ret = self.ui.tableWidget.item(_row,3).text() if _ret == '?': QtGui.QMessageBox.information(self, 'TMV3', "you have to set the Serial Numbers", QtGui.QMessageBox.Ok) return _cD = self.ui.tableWidget.cellWidget(_row,4) _ret = _cD.date() if _ret == QtCore.QDate(2000,1,1): QtGui.QMessageBox.information(self, 'TMV3', "you have to set the Calibration Dates", QtGui.QMessageBox.Ok) return try: shutil.copy("../Templates/TMV3.TKR3",self.outputFile) self.saveTKR3() except Exception as _err: QtGui.QMessageBox.information(self, 'TMV3', str(_err), QtGui.QMessageBox.Ok) return self.saveTKR3() return