Problem with QCalendarWidget_clicked
Solved
General and Desktop
-
Hello, I am currently trying to work with the on_CalendarWidget_clicked Signal with the following code. My problem is, that the if-Statement only works, as long as I don't use the else.
Whenever I try to use the else-Statement, the if-Statement is never correct and it always prints out "no Match".the StringList is constructed: date(dd.MM.yyyy), someHoliday, date(dd.MM.yyyy), someHoliday, ...
void MainWindow::on_myCalendarWidget_clicked(const QDate &date) { QString clickedDate = date.toString("dd.MM.yyyy"); for(int i = 0; i<StringList.size(); i++){ QString actualDate = StringList.at(i); if((actualDate.compare(clickedDate))==0){ ui->textEdit->setText(StringList.at(i+1)); }//else{ //ui->textEdit->setText("no Match"); //} } }
-