本文整理汇总了Python中PyQt5.QtWidgets.QDateEdit方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QDateEdit方法的具体用法?Python QtWidgets.QDateEdit怎么用?Python QtWidgets.QDateEdit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QDateEdit方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDateEdit [as 别名]
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(384, 300)
self.calendarWidget = QtWidgets.QCalendarWidget(Dialog)
self.calendarWidget.setGeometry(QtCore.QRect(40, 30, 312, 183))
self.calendarWidget.setObjectName("calendarWidget")
self.dateEdit = QtWidgets.QDateEdit(Dialog)
self.dateEdit.setGeometry(QtCore.QRect(120, 250, 110, 22))
self.dateEdit.setObjectName("dateEdit")
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
示例2: createForm
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDateEdit [as 别名]
def createForm(self):
self._date_widget = QtWidgets.QDateEdit(QtCore.QDate.currentDate())
self._date_widget.setCalendarPopup(True)
self._time_widget = QtWidgets.QTimeEdit(QtCore.QTime.currentTime())
layout = QtWidgets.QFormLayout()
layout.addRow(_('Date:'), self._date_widget)
layout.addRow(_('Time:'), self._time_widget)
widget = QtWidgets.QGroupBox()
widget.setTitle(_('Set system date and time:'))
widget.setLayout(layout)
return widget
示例3: createEditor
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDateEdit [as 别名]
def createEditor(self, parent, option, proxyModelIndex):
# make sure to explicitly set the parent
# otherwise it pops up in a top-level window!
date_inp = qtw.QDateEdit(parent, calendarPopup=True)
return date_inp
示例4: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDateEdit [as 别名]
def __init__(self):
super().__init__()
self.setLayout(qtw.QFormLayout())
self.inputs = {}
self.inputs['Customer Name'] = qtw.QLineEdit()
self.inputs['Customer Address'] = qtw.QPlainTextEdit()
self.inputs['Invoice Date'] = qtw.QDateEdit(
date=qtc.QDate.currentDate(), calendarPopup=True)
self.inputs['Days until Due'] = qtw.QSpinBox(
minimum=0, maximum=60, value=30)
for label, widget in self.inputs.items():
self.layout().addRow(label, widget)
self.line_items = qtw.QTableWidget(
rowCount=10, columnCount=3)
self.line_items.setHorizontalHeaderLabels(
['Job', 'Rate', 'Hours'])
self.line_items.horizontalHeader().setSectionResizeMode(
qtw.QHeaderView.Stretch)
self.layout().addRow(self.line_items)
for row in range(self.line_items.rowCount()):
for col in range(self.line_items.columnCount()):
if col > 0:
w = qtw.QSpinBox(minimum=0, maximum=300)
self.line_items.setCellWidget(row, col, w)
submit = qtw.QPushButton('Create Invoice', clicked=self.on_submit)
self.layout().addRow(submit)
示例5: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDateEdit [as 别名]
def __init__(self):
super().__init__()
self.setLayout(qtw.QFormLayout())
self.inputs = dict()
self.inputs['Customer Name'] = qtw.QLineEdit()
self.inputs['Customer Address'] = qtw.QPlainTextEdit()
self.inputs['Invoice Date'] = qtw.QDateEdit(
date=qtc.QDate.currentDate(), calendarPopup=True)
self.inputs['Days until Due'] = qtw.QSpinBox(
minimum=0, maximum=60, value=30)
for label, widget in self.inputs.items():
self.layout().addRow(label, widget)
self.line_items = qtw.QTableWidget(
rowCount=10, columnCount=3)
self.line_items.setHorizontalHeaderLabels(
['Job', 'Rate', 'Hours'])
self.line_items.horizontalHeader().setSectionResizeMode(
qtw.QHeaderView.Stretch)
self.layout().addRow(self.line_items)
for row in range(self.line_items.rowCount()):
for col in range(self.line_items.columnCount()):
if col > 0:
w = qtw.QSpinBox(minimum=0, maximum=300)
self.line_items.setCellWidget(row, col, w)
submit = qtw.QPushButton('Create Invoice', clicked=self.on_submit)
self.layout().addRow(submit)
self.on_submit()
开发者ID:PacktPublishing,项目名称:Mastering-GUI-Programming-with-Python,代码行数:31,代码来源:invoice_maker_printable.py
示例6: dt_tabela
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QDateEdit [as 别名]
def dt_tabela(self, tabela, row, col, data, status):
item = QtWidgets.QDateEdit()
# item.setGeometry(QRect(120, 18, 140, 18))
item.setFixedWidth(90)
if status == 1:
item.setReadOnly(True)
item.setStyleSheet("QDateEdit {\n"
"background: #FFF;\n"
"border: none;\n"
"font-family: \"Arial\";\n"
"font-size: 12px;\n"
"font-weight: bold;\n"
"color: rgb(80,79,79)\n"
"}\n"
" QDateEdit::drop-down {\n"
" subcontrol-origin: padding;\n"
" subcontrol-position: top right;\n"
" width: 20px;\n"
" border-left-width: 1px;\n"
" border-left-color: darkgray;\n"
" border-left-style: solid; /* just a single line */\n"
" border-top-right-radius: 3px; /* same radius as the QComboBox */\n"
" border-bottom-right-radius: 3px;\n"
" }\n"
"QDateEdit::down-arrow {\n"
" image: url(" +
self.resourcepath('Images/down.png')+");\n"
" }\n"
"QCalendarWidget QAbstractItemView:enabled \n"
" {\n"
"border: none;\n"
" font-size:13px; \n"
" color: #000; \n"
" background-color: #F1F1F1; \n"
" selection-background-color: rgb(64, 64, 64); \n"
" selection-color: rgb(0, 255, 0); \n"
" }\n"
"QCalendarWidget QToolButton {\n"
" border: none;\n"
" color: #000\n"
" }\n"
"\n"
" QCalendarWidget QMenu {\n"
" width: 150px;\n"
" left: 20px;\n"
" color: white;\n"
" font-size: 18px;\n"
" background-color: rgb(100, 100, 100);\n"
" }\n"
"QCalendarWidget QWidget#qt_calendar_navigationbar\n"
"{ \n"
"border: none;\n"
"}")
item.setCalendarPopup(True)
item.setDate(data)
tabela.setCellWidget(row, col, item)
#Retorna cor status para quantidade abaixo do minimo