QDateEdit validations - c++

I'm trying validate two QDateEdits. I have two fields, startdate and enddate and i want to validate that the minimum date of enddate be the selected startdate date. But also, i want give the user opportunity that the enddate field can be empty.
I conected both fields
connect(startDate,SIGNAL(dateChanged(QDate)),endDate,SLOT(setMinDate(QDate)));
startDate and endDate are QDateEdit with a popup calendar.
So, where is the problem here?? When i click over endDate the minimun date it's ok but the next day (fisrt valid date) appears in blue color like it was selected, but when i clicked over that date the popup close and the date it's not set. For example:
When i open the form the startdate field have by default the current date. Latter i click over endDate field and the minimum allowed date is one more day wich it's ok, but this minimum allowed date it's blue marked and when i clicked the date it's not set.
Sorry if my english it's so bad, i hope that you can help me. Thanks any way

I found what my problem is. I connected the slot to dateChanged(QDate) signal, so, by default the QDateEdit set the first allowed date as selected, so if you select it again the signal it's not emited and by result the date it's not set. My solution is use editingFinished() signal instead dateChanged(QDate) signal. I hope has been helpful. Regards,

Related

Column with mutiples status - automatic today's date when status is changed to "completed"

I have a Microsoft List with a column named "Status" which is a column type with multiples choices.
I want the user to have today's date when he chose a certain choice from the column "Status".
For instance, when the status is "completed", then the column "Date of completion" shall display automatically today's date.
What would be the formula, and should it be entered in the column "Date of completion" parameter > column validation in the field "formula" ?
Or do I need to use power automate ?
Thanks for your help,
I would use column formatting for this.. I would use Power Automate for this.
Create a flow like below.
Use the When an item is created or modified trigger action.
In the Settings add a trigger expression like below (again change it to use the internal column names).
That expression checks if the Status field value is Completed and if the Date of Completion field is still empty.
#and(equals(triggerOutputs()?['body/Status/Value'], 'Completed'), empty(triggerOutputs()?['body/Dateofcompletion']))
In the Update Item use UtcNow for the Date of Completion field
utcNow()

How to write a query based on the Date item, in interactive grid

I have a date field and a interactive grid. I am trying to generate the Interactive grid based on the value inputted in the date field.
I am trying to write the query as below :
select pap.effective_start_date , pap.effective_end_date
from per_all_people_f pap
where :SELECT_DATE between pap.effective_start_date and
pap.effective_end_date
Here, SELECT_DATE is the name of the Date field (datatype Date picker). I am writing a dynamic action on Change of Date field, and refreshing the interactive grid region.
But when I change the value in Date field, it doesn't return any rows.
I have done a similar change where my interactive grid was based on a dropdown. There I had to set the "page action on selection" to Submit, and it worked. But here, since it is a Date field, the "Page Action on selection" property doesn't appear on the page .
Can somebody please suggest, how can I achieve this.
You need to explicitly convert your bind variables, which are treated as strings, to dates.
to_date(:SELECT_DATE)
The format mask will come from the application properties, or you can be explicit with that, too.

JSRender- How to display calendar icon and make date picker field read only

I am using the following code for datepicke in my template.
{^{datepicker fromValue readonly="true" class="myclass"/}}
{^{datepicker toValue ^_minDate=fromValue class="myclass" readonly icon="show"/}}
I tried to achieve following things.
I want to make the datepicker field readonly. For the above code it is not happening.
How to show the calendar icon within the text box. currently its not happening. icon=show...I tried it . I didn't see anywhere.
In my case I have to show the toDate and FromDate at same time. If user first selects the toValue and come back to from value , how to restrict his max date. Currently it is not restricting user.So I can able to select from date which is greater than todate.
Thanks in advance.
For a readonly datepicker, it needs to be on a div, and have _disabled=true. If it is not a div the setting _disabled=true will disable the input, so the datepicker won't show.
{^{datepicker startDate elem="div" _disabled=true/}}
For providing an icon:
{^{datepicker startDate
_showOn= "button"
_buttonImage="https://jqueryui.com/resources/demos/datepicker/images/calendar.gif"
_buttonImageOnly= true
_buttonText= "Select date"
/}}
For start and end date, see http://www.jsviews.com/#samples/tag-controls/datepicker/simple
{^{datepicker startDate
^_maxDate=endDate
/}}
{^{datepicker endDate
^_minDate=startDate
/}}

QDate empty value on add product page

I have a form to insert a product on vector. My form is a QT dialog form and I'd like that the space where I insert the date of purchase is blank and when I click on the QDateEdit the current date appears and I can set the date I prefer.
When I add the date to the vector ( both blank and setted date) I show it on QTableWidget. the column of purchase date must show me that value and if it is blank I'd like to be able to set the date I prefer ( after this I have a function to update the info on the vector).
How can I do this? Because on Qdate Class I have nothing that allows me to do this thing (http://doc.qt.io/qt-5/qdate.html).
I have to use qt and c++
thank you, I hope I explained the problem in a good way.
An easy way: use a customized QDateEdit and enable the QCalendarWidget popup, you can customize it using QSS. Example:
When the user sets the new date, just connect the signal dateChanged() whit your own slot and update your data.

How to add another date to a date selected from popup calendar in Qt C++

I am doing a library management system project in QT C++. in handling burrowing of books i use qdatetimeedit to select the current date. I want to assign the return date by adding 2 weeks to the current date and it should be displayed in a line edit once i select the current date from popup calendar. I don't have an idea to carry this out. Please help. Thank you in advance
After trying a lot I figured It up by myself.
QDate current = ui->dtetimeCurrnt->date();
//adding 14 days to the current date to get the returning date
QDate returnDate = current.addDays(14);
//assigning the returndate to dateedit
ui->dteditRetrn->setDate(returnDate);
Since I couldn't use lineEdit I used a dateEdit.