Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: tinnews@isbd.co.uk Newsgroups: comp.lang.python Subject: Re: PyQt QCalendarWidget events question Date: Mon, 16 Jul 2012 17:28:38 +0100 Lines: 41 Message-ID: References: X-Trace: individual.net vZ3M5ZGegZQ2em9MqeWvLgiKnXByV212qBXa0kminCxXNTTroz6lg9q2sWh42anXI= X-Orig-Path: not-for-mail Cancel-Lock: sha1:rDpTfPu07WsDKv2GmwE2IvCJ3XQ= User-Agent: tin/2.0.0-20110823 ("Ardenistiel") (UNIX) (Linux/3.2.0-26-generic (x86_64)) Xref: csiph.com comp.lang.python:25424 tinnews@isbd.co.uk wrote: > I am trying to use the PyQt4 calendar widget to perform some different > actions on specific dates. There are three events available:- > > selectionChanged() > activated(QDate) > clicked(QDate) > > On trying all these out it would appear that the event handlers get > called as follows:- > > The clicked(QDate) event gets called if you click on an already > selected date. > > The selectionChanged() and then the clicked(QDate) events are > called when you click on a new date. > > The selectionChanged(), then the clicked(QDate) and then the > activated(QDate) events are called if you double-click on a new date. > > The clicked(QDate) and then the activated(QDate) events are called > if you double-click on an already selected date. > > > How can I get a single-click on a date to get 'Action1' and double-click > on a date to get 'Action2'? I'm sorry, this got sent a bit before I'd completed it. The trouble is that I want to run Action1 if I single-click on a date whether or not it's a changed date and I want to run Action2 if I double-click on a date whether or not it's a changed date. However I don't see how I can do this because of the order in which the event handlers are called. Is there any way to manipulate this so I can get the result I want? At the moment the only way I can see to do it is to wait a while after a click and then look at what actions occurred but this seems a real bodge. -- Chris Green