Skip to content
Snippets Groups Projects
Commit cf9a0bb2 authored by Garrett Bates's avatar Garrett Bates
Browse files

Changed signal used by calendardialog implementation to enable keyboard input...

Changed signal used by calendardialog implementation to enable keyboard input for date selection in addition to mouse input.
parent 8f2eb6de
No related branches found
No related tags found
1 merge request!3Main UI and miscellaneous associated widgets
...@@ -11,18 +11,23 @@ class CalendarDialog(QtWidgets.QDialog, Ui_CalendarDialog): ...@@ -11,18 +11,23 @@ class CalendarDialog(QtWidgets.QDialog, Ui_CalendarDialog):
super().__init__(parent) super().__init__(parent)
self.setupUi(self) self.setupUi(self)
# Connect the "clicked" signal from the QCalendar to our # Connect the "selectionChanged" signal from the QCalendar
# custom slot # This lets the user select a date using either the mouse, or
self.calendarWidget.clicked.connect(self.onDatePicked) # arrow keys on the keyboard.
self.calendarWidget.selectionChanged.connect(self.onDatePicked)
date = self.calendarWidget.selectedDate()
doy = date.dayOfYear()
self.julianDateLineEdit.setText(str(doy))
@QtCore.Slot(QtCore.QDate) @QtCore.Slot()
def onDatePicked(self, date): def onDatePicked(self):
# This slot retrieves the day of year format from the # This slot retrieves the day of year format from the
# date that the user clicked on in the calendar, # date that the user has selected in the calendar,
# and sends it to the read-only line edit in the same widget # and sends it to the read-only line edit in the same widget
# If the original functionality of the Calendar is required # If the original functionality of the Calendar is required
# or preferred, I will replace this with a subclass or completely # or preferred, I will replace this with a subclass or completely
# custom calendar widget in the near future. # custom calendar widget in the near future.
date = self.calendarWidget.selectedDate()
doy = date.dayOfYear() doy = date.dayOfYear()
self.julianDateLineEdit.setText(str(doy)) self.julianDateLineEdit.setText(str(doy))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment