Results 1 to 2 of 2

Thread: PyQt --How to wire up the signals from QDateEdit to slots on QCalendarWidget

  1. #1
    Join Date
    Oct 2016
    Posts
    1
    Qt products
    Platforms
    Windows

    Question PyQt --How to wire up the signals from QDateEdit to slots on QCalendarWidget

    Hello All

    I am trying to "Synchronise" the QCalendarWidget and QDateEdit widgets. I have managed to synchonise other widgets like sliders and tool bars by using the following statement self.ui.horizontalScrollBar.valueChanged.connect(s elf.scrollhorizontal)

    I have managed to use signals and slots to get the QDateEdit widget updated when selecting the date in QCalendarWidget as per the following

    QtCore.QObject.connect(self.ui.calendarWidget, QtCore.SIGNAL('selectionChanged()'), self.dispdate)


    def dispdate(self):
    self.ui.dateEdit.setDate(self.ui.calendarWidget.se lectedDate())

    I do not seem to do the reverse i.e. wire up the QCalendarWidget so that when I change the QDateEdit value the QCalendarWidget gets updated

    I have tried the following

    QtCore.QObject.connect((self.ui.dateEdit), QtCore.SIGNAL('editingFinished()'),self.calwupd)

    def calwupd(self):
    self.ui.calendarWidget.setSelectedDate(self.ui.dat eEdit.Date())

    Environment Details:
    Windows 8.1
    Python 3.4
    PyQt 4

    Your help would be much appreciated.

    Many Thanks

    James

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts

    Default Re: PyQt --How to wire up the signals from QDateEdit to slots on QCalendarWidget

    You could directly connect the QDateEdit's dateChanged() signal to the QCalendarWidget's setSelectedDate() slot.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 18th April 2013, 12:15
  2. QDateEdit with QCalendarWidget always shown
    By JoZCaVaLLo in forum Qt Programming
    Replies: 3
    Last Post: 31st March 2011, 14:35
  3. 2 QDateEdit with 1 QCalendarWidget ?
    By ouekah in forum Newbie
    Replies: 4
    Last Post: 26th April 2010, 09:24
  4. Question about QCalendarWidget with PyQT
    By hf in forum Qt Programming
    Replies: 2
    Last Post: 21st April 2008, 22:40
  5. QSocket - signal for network wire disconnection
    By manivannan_1984 in forum Qt Programming
    Replies: 7
    Last Post: 5th September 2006, 13:52

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.