Re: [Qgis-user] qt designer does not have/show QgsDateEdit widget

2022-07-20 Thread Janneke van Dijk via Qgis-user
Hi Richard and Andrea (and others),

thanks for clarifying/confirming - then it is not something I
misunderstood. I originally had the QDateEdit widget, which was working,
but giving a warning that it will not accept NULL values. As I would like
to be able to set it to NULL I thought of using QgsDateEdit. I have now
indeed managed to instead format the QgsDateTimeEdit widget to only show
the date, which will do for my purpose.

I am now trying to adjust the code that was working for QDateEdit to work
for the QgsDateTimeEdit with the following function that gets called
clicking a button. The first message will display the time and date
correctly, so 'now' seems to have the correct value. The second message
does not get displayed, but I also do not get an error message, and the
date does not get changed. Which makes me believe
"self.assesmentdate.setDateTime(now)" is not correct.

def assesmentdate_now(self):
if self and self.layer.isEditable():
now = QtCore.QDateTime.currentDateTime()
QgsMessageLog.logMessage(now.toString(), 'MyPlugin',
level=Qgis.Info)
self.assesmentdate.setDateTime(now)
QgsMessageLog.logMessage('test', 'MyPlugin', level=Qgis.Info)


What would be the correct syntax for setting the QgsDateTimeEdit widget to
show the current date?  Or does anyone have ideas how I can find out what's
happening, seeing that I am not getting error messages? The script gets
called by the attribute form.

Thanks for any thoughts,
Janneke

On Wed, Jul 20, 2022 at 10:44 AM Richard Duivenvoorde 
wrote:

> Hi Janneke,
>
> I'm on master here with designer with all qgs widgets, and I do not have
> it either.
>
> When I create a form though, with a field which has a datetime field, I
> CAN set the 'Field Format' to 'Date'-only...
>
> So maybe there is some extra sip/development work needed to make this
> widget also available in QtDesigner?
> (try to ask this question on the defv list?)
>
> Or (not tested), maybe you can create an ui iwth QgsDateTime, and manually
> edit the ui file?
>
> HTH, Regards,
>
> Regards,
>
> Richard Duivenvoorde
>
> On 7/19/22 20:28, Janneke van Dijk via Qgis-user wrote:
> > Dear all,
> >
> > I need a date widget that can be set to a null date. From
> https://qgis.org/pyqgis/master/gui/QgsDateEdit.html#module-QgsDateEdit <
> https://qgis.org/pyqgis/master/gui/QgsDateEdit.html#module-QgsDateEdit> I
> understand that this should be possible (from 3.14 upwards). In Qt Designer
> (osgeo4W/bin/qgis-designer.bat which I understand is shipped with QGIS
> 3.26) I only see the QgsDateTimeEdit widget.
> >
> > image.png
> >
> > How can I use the QgsDateEdit widget?
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] qt designer does not have/show QgsDateEdit widget

2022-07-20 Thread Richard Duivenvoorde via Qgis-user

Hi Janneke,

I'm on master here with designer with all qgs widgets, and I do not have it 
either.

When I create a form though, with a field which has a datetime field, I CAN set 
the 'Field Format' to 'Date'-only...

So maybe there is some extra sip/development work needed to make this widget 
also available in QtDesigner?
(try to ask this question on the defv list?)

Or (not tested), maybe you can create an ui iwth QgsDateTime, and manually edit 
the ui file?

HTH, Regards,

Regards,

Richard Duivenvoorde

On 7/19/22 20:28, Janneke van Dijk via Qgis-user wrote:

Dear all,

I need a date widget that can be set to a null date. From 
https://qgis.org/pyqgis/master/gui/QgsDateEdit.html#module-QgsDateEdit 
 I 
understand that this should be possible (from 3.14 upwards). In Qt Designer 
(osgeo4W/bin/qgis-designer.bat which I understand is shipped with QGIS 3.26) I only 
see the QgsDateTimeEdit widget.

image.png

How can I use the QgsDateEdit widget?

___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


Re: [Qgis-user] qt designer does not have/show QgsDateEdit widget

2022-07-20 Thread Andrea Giudiceandrea via Qgis-user

*Janneke van Dijk*
/Tue Jul 19 11:28:30 PDT 2022/

In Qt Designer
(osgeo4W/bin/qgis-designer.bat which I understand is shipped with QGIS
3.26) I only see the QgsDateTimeEdit widget.

How can I use the QgsDateEdit widget?


Hi Janneke,
AFAIK only a subset of Qgs* gui classes are available as QGIS custom 
widgets plugins for Qt Designer: see [1].


In the meantime that you search for and eventually find a workaround, I 
think you could file a Feature Request [1] so that some developer can 
add the plugin in an next release.


Best regards.

Andrea Giudiceandrea

[1] https://github.com/qgis/QGIS/tree/master/src/customwidgets
[2] https://github.com/qgis/QGIS/issues/new/choose___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user


[Qgis-user] qt designer does not have/show QgsDateEdit widget

2022-07-19 Thread Janneke van Dijk via Qgis-user
Dear all,

I need a date widget that can be set to a null date. From
https://qgis.org/pyqgis/master/gui/QgsDateEdit.html#module-QgsDateEdit I
understand that this should be possible (from 3.14 upwards). In Qt Designer
(osgeo4W/bin/qgis-designer.bat which I understand is shipped with QGIS
3.26) I only see the QgsDateTimeEdit widget.

[image: image.png]

How can I use the QgsDateEdit widget?

Thanks for your assistance,

Janneke
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user