Date and Time
-
How should i assign Time to Min and max of DateTimeAxis.
I am able to get time by Qt.formatTime(new Date(),"hh:mm")
But this is string, min and max are not taking this value.
I want to assign Qt.formatTime(new Date(),"hh:mm") to min and
max value should be 30 min more from current time.DateTimeAxis { id: x_axis tickCount: 4 min: max: } -
How should i assign Time to Min and max of DateTimeAxis.
I am able to get time by Qt.formatTime(new Date(),"hh:mm")
But this is string, min and max are not taking this value.
I want to assign Qt.formatTime(new Date(),"hh:mm") to min and
max value should be 30 min more from current time.DateTimeAxis { id: x_axis tickCount: 4 min: max: }I can only guess, that you'll need a JS-Date object
There's a date/QDate basic type
http://doc.qt.io/qt-5/qtqml-cppintegration-data.html#basic-qt-data-types
but nothing for timeso maybe this works? It's untested, I have only worked with c++ side of QtCharts module.
DateTimeAxis { id: x_axis tickCount: 4 min: new Date(year, month, day, hours, minutes, seconds, milliseconds); max: new Date(year, month, day, hours, minutes +30, seconds, milliseconds); } -
I can only guess, that you'll need a JS-Date object
There's a date/QDate basic type
http://doc.qt.io/qt-5/qtqml-cppintegration-data.html#basic-qt-data-types
but nothing for timeso maybe this works? It's untested, I have only worked with c++ side of QtCharts module.
DateTimeAxis { id: x_axis tickCount: 4 min: new Date(year, month, day, hours, minutes, seconds, milliseconds); max: new Date(year, month, day, hours, minutes +30, seconds, milliseconds); }@J.Hilk this is not working as it is saying that (year,month....) all these variables are not declared.
How you used to define min and max in Qtcharts in C++ side ?
-
@J.Hilk this is not working as it is saying that (year,month....) all these variables are not declared.
How you used to define min and max in Qtcharts in C++ side ?
@Bhushan_Sure said in Date and Time:
@J.Hilk this is not working as it is saying that (year,month....) all these variables are not declared.
How you used to define min and max in Qtcharts in C++ side ?
Well, yes of course, that is the abstract syntax I posted, you would have to replace the placeholder names with actual numbers!
-
@Bhushan_Sure said in Date and Time:
@J.Hilk this is not working as it is saying that (year,month....) all these variables are not declared.
How you used to define min and max in Qtcharts in C++ side ?
Well, yes of course, that is the abstract syntax I posted, you would have to replace the placeholder names with actual numbers!
@J.Hilk i want current system time ? is there any function ? to get it so that i can assign it
-
@J.Hilk i want current system time ? is there any function ? to get it so that i can assign it
afaik
new Date()generates a new Date object containing the current date and time. -
afaik
new Date()generates a new Date object containing the current date and time.DateTimeAxis { id: x_axis tickCount: 4 format: "hh:mm" min:new Date(new Date() - 1800000) max: new Date() }This Solved my problem.