[QGIS-Developer] Drag and drop form function QdateEdit Widget init
Denis Rouzaud
denis.rouzaud at gmail.com
Fri Mar 25 01:17:58 PDT 2022
QgsDateTimeEdit implements setDateTime, which is not virtual in
QDateTimeEdit.
It's probably that you have to find a QDateTimeEdit rather than the Qt
native one.
Not 100% sure this is the issue though, but it won't hurt.
Le ven. 25 mars 2022 à 09:11, PIERRE Sylvain via QGIS-Developer <
qgis-developer at lists.osgeo.org> a écrit :
>
> Thanks for tip Richard, but I've tried with
> today = QtCore.QDateTime.currentDateTime()
> But it's not working
>
>
>
>
> -----Message d'origine-----
> De : Richard Duivenvoorde <rdmailings at duif.net>
> Envoyé : vendredi 25 mars 2022 08:50
> À : PIERRE Sylvain <sylvain.pierre at alsace.eu>;
> qgis-developer at lists.osgeo.org
> Objet : Re: [QGIS-Developer] Drag and drop form function QdateEdit Widget
> init
>
> Soyez vigilant : ce courriel provient d'une organisation externe à la CeA.
> • Assurez-vous d’abord qu’il ne s’agit pas d’un email malveillant avant de
> cliquer sur tout lien ou pièce jointe.
> ==================================================
>
> On 3/25/22 08:33, PIERRE Sylvain via QGIS-Developer wrote:
>
> > But this is not working with QDateEdit widget :
> >
> > today=date.today()
> >
> > control=dialog.findChild(QDateEdit,"date_insert")
> >
> > control.setDateTime(today)
> >
> > What is the right syntax to init the date widget ? It’s impossible to
> debug init script (or may be I’m missing something…)
>
> Hi,
>
> Which module is 'date.today()' from, not Qt is it?
>
> You probably have to use the QDatetime:
> https://doc.qt.io/qt-5/qdatetime.html#currentDateTime
>
> >>> QDateTime.currentDateTime()
> PyQt5.QtCore.QDateTime(2022, 3, 25, 8, 44, 19, 963)
>
> And set THAT with the widget?
>
> See: https://doc.qt.io/qt-5/qdatetimeedit.html#dateTime-prop
>
> (it always a little hassle to juggle with date/time etc in Python/Qt)
>
> Regards,
>
> Richard Duivenvoorde
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20220325/d58ec135/attachment.html>
More information about the QGIS-Developer
mailing list