I found a mouseDoubleClickEvent
in QCalendarWidget
, but it doesn't work on date cell. Is there a good solution?
Asked
Active
Viewed 587 times
1 Answers
1
[signal]void QCalendarWidget::activated(const QDate &date
This signal is emitted whenever the user presses the Return or Enter key or double-clicks a date in the calendar widget.
from PyQt5 import QtWidgets, QtCore
def activatedDate(date):
print(date)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
cal = QtWidgets.QCalendarWidget()
cal.activated.connect(activatedDate) # <---
fn = cal.font()
fn.setPointSize(20)
cal.setFont(fn)
prev_button = cal.findChild(QtWidgets.QToolButton, "qt_calendar_prevmonth")
next_button = cal.findChild(QtWidgets.QToolButton, "qt_calendar_nextmonth")
for btn in (prev_button, next_button):
btn.setIconSize(QtCore.QSize(40, 40))
cal.resize(640, 480)
cal.show()
sys.exit(app.exec_())