QDateTime stamp2TS(const QString &ts) { if(ts.length() != 17) return QDateTime(); int year = ts.mid(0,4).toInt(); int month = ts.mid(4,2).toInt(); int day = ts.mid(6,2).toInt(); int hour = ts.mid(9,2).toInt(); int min = ts.mid(12,2).toInt(); int sec = ts.mid(15,2).toInt(); QDate xd; xd.setYMD(year, month, day); if(!xd.isValid()) return QDateTime(); QTime xt; xt.setHMS(hour, min, sec); if(!xt.isValid()) return QDateTime(); return QDateTime(xd, xt); }
QVariant TrainScheduleEngine::parseLine(QString &line) { QMap<QString,QVariant> data; QTime start; QStringList cut = line.split(";"); if (cut.count() >= 5) { QStringList HourMinute = cut[2].split(":"); start.setHMS(HourMinute[0].toInt(), HourMinute[1].toInt(), 0); QStringList stations = cut[4].trimmed().split(QRegExp("\\s*,\\s*")); data["type"] = cut[0].trimmed(); data["stations"] = stations; data["start"] = start; data["destination"] = cut[3].trimmed(); if (cut.count() >= 6) { data["delay"] = cut[5].trimmed(); } else { data["delay"] = ""; } if (cut.count() >= 7) { // the data are a mix of Utf8 and Latin-1 characters // so the following lines are ugly but... it works if (cut[6][0] == 65533) { cut[6].remove(0, 1); } data["comment"] = cut[6].trimmed(); } else { data["comment"] = ""; } } else { data["type"] = "Unknown"; data["start"] = start.setHMS(0,0,0); data["destination"] = "Unknown"; data["stations"] = QStringList(); data["comment"] = ""; data["delay"] = ""; } return data; }
void testFollowUp(){ FollowUpRecord f; f.setConsultationRecordId(1); f.setDetails(QString("Details string")); QDate qd; QTime qt; QDateTime d; qd.setYMD(2000,1,1); qt.setHMS(12,12,12); d.setDate(qd); d.setTime(qt); f.setDueDateTime(d); f.setStatus(FollowUpRecord::PENDING); if(f.getConsultationRecordId() != 1){ qDebug() << "ERROR WITH /followuprecord/consultationrecordid"; } if(QString::compare(QString("Details string"),f.getDetails())!=0){ qDebug() << "ERROR WITH /followuprecord/details TEST"; } if(f.getDueDateTime().date().day() != 1){ qDebug() << "ERROR WITH /followuprecord/datetime/day TEST"; } if(f.getDueDateTime().date().month() != 1){ qDebug() << "ERROR WITH /followuprecord/datetime/month TEST"; } if(f.getDueDateTime().date().year() != 2000){ qDebug() << "ERROR WITH /followuprecord/datetime/year TEST"; } if(f.getDueDateTime().time().hour() != 12){ qDebug() << "ERROR WITH /followuprecord/datetime/hour TEST"; } if(f.getDueDateTime().time().minute() != 12){ qDebug() << "ERROR WITH /followuprecord/datetime/minute TEST"; } if(f.getDueDateTime().time().second() != 12){ qDebug() << "ERROR WITH /followuprecord/datetime/second TEST"; } if(f.getStatus() != FollowUpRecord::PENDING){ qDebug() <<"ERROR WITH /followuprecord/status"; } }
void NetCdfConfigureDialog::getDaysTime(double minSince, QTime &time, int &days) { long tmpMin = (long) minSince; long minuits = tmpMin % 60; long tmpHours = tmpMin / 60; long hours = tmpHours % 24; days = (int) (tmpHours / 24); time.setHMS(hours,minuits,0); }
void MainWindow::checkTime() { QTime currentTime = QDateTime::currentDateTime().time(); currentTime.setHMS(currentTime.hour(), currentTime.minute(), 0); qDebug() << storage->targetTime; if (storage->targetTime == currentTime){ storage->runAudit(); } }
const QDateTime ADBColumn::toQDateTime(int useBackup) { if (intDataType != FIELD_TYPE_DATETIME && intDataType != FIELD_TYPE_TIMESTAMP ) ADBLogMsg(LOG_WARNING, "ADBColumn::toQDate(%d) - Warning! Column is not a date", intColumnNo); QDateTime retVal; QDate tmpDate; QTime tmpTime; QString tmpQStr; if (useBackup) tmpQStr = intOldData; else tmpQStr = intData; if (tmpQStr.length() == 14) { // Its a time stamp in the form YYYYMMDDHHMMSS tmpDate.setYMD( tmpQStr.mid(0,4).toInt(), tmpQStr.mid(4,2).toInt(), tmpQStr.mid(6,2).toInt() ); tmpTime.setHMS( tmpQStr.mid( 8,2).toInt(), tmpQStr.mid(10,2).toInt(), tmpQStr.mid(12,2).toInt() ); } else { // Its a datetime in the form YYYY-MM-DD HH:MM:SS tmpDate.setYMD( tmpQStr.mid(0,4).toInt(), tmpQStr.mid(5,2).toInt(), tmpQStr.mid(8,2).toInt() ); tmpTime.setHMS( tmpQStr.mid(11,2).toInt(), tmpQStr.mid(14,2).toInt(), tmpQStr.mid(17,2).toInt() ); } retVal.setDate(tmpDate); retVal.setTime(tmpTime); return (const QDateTime) retVal; }
/** * Parse a time value from the provided string. * * @param value The text to be parsed * @param ok Pointer to a boolean value which will represent the success or * failure of the parsing attempt * @return The number of seconds after midnight in the parsed time, shown as * a string */ QString Formatting::parseTimeString(const QString &value, bool *ok) { // check for imported blank if (value.isEmpty()) { *ok = true; return "-1"; } int length = value.length(); int firstColon = value.indexOf(':'); if (firstColon == -1) { // assume it's a number of seconds, as used internally int totalSeconds = value.toInt(ok); if (!(*ok) || totalSeconds < -1 || totalSeconds > 86399) { *ok = false; } return value; } // from here on is used only when importing if (firstColon < 1 || length < firstColon + 3) { *ok = false; return value; } int hours = value.left(firstColon).toInt(ok); if (!(*ok)) { return value; } int minutes = value.mid(firstColon + 1, 2).toInt(ok); if (!(*ok)) { return value; } int seconds = 0; int secondColon = value.indexOf(':', firstColon + 1); if (secondColon != -1 && length > secondColon + 2) { seconds = value.mid(secondColon + 1, 2).toInt(ok); if (!(*ok)) { return value; } } if (value.indexOf("pm", 0, Qt::CaseInsensitive) != -1) { if (hours < 12) { hours += 12; } } else if (value.indexOf("am", 0, Qt::CaseInsensitive) != -1 && hours == 12) { hours = 0; } QTime time; if (!time.setHMS(hours, minutes, seconds)) { *ok = false; return value; } QTime midnight; int totalSeconds = midnight.secsTo(time); *ok = true; return QString::number(totalSeconds); }
QTime UtilMethods::roundTime(QTime timeVal) { QTime now = timeVal; int hr = now.hour(); int min = now.minute(); min=(min<=30)?30:0; now.setHMS(hr,min,0); return now; }
void DateSettings::onConfirmButtonClicked() { QDate date; date.setDate(m_yearWidget->value(), m_monthWidget->value(), m_dayWidget->value()); QTime time; time.setHMS(m_timeWidget->hour(), m_timeWidget->minute(), 0); QDateTime datetime(date, time); Q_EMIT requestSetTime(datetime); back(); }
QTime wgt_QVideoPlayer::GetCurrentPos() { if (ActualPosition!=-1) { int TimeMSec =ActualPosition-(ActualPosition/1000)*1000; int TimeSec =int(ActualPosition/1000); int TimeHour =TimeSec/(60*60); int TimeMinute =(TimeSec%(60*60))/60; QTime tPosition; tPosition.setHMS(TimeHour,TimeMinute,TimeSec%60,TimeMSec); return tPosition; } else return QTime(0,0,0,0); }
/*! \internal */ QDateTime Event::start( bool actual ) const { QDateTime dt = TimeConversion::fromUTC( startUTC ); if ( actual && typ == AllDay ) { QTime t = dt.time(); t.setHMS( 0, 0, 0 ); dt.setTime( t ); } return dt; }
/*! * \fn QString MessageProgrammesDialog::getValueFromRow(int row) * \brief Récupère les données du tableau et en fait une chaine de caractère * \param[in] row Ligne du tableau à récuprerer * \returns la valeur des champs de la ligne du tableau * */ QString MessageProgrammesDialog::getValueFromRow(int row) { QString value = ""; QString str; QTime time; (modele->item(row,10)->data(Qt::CheckStateRole) == QVariant(Qt::Checked) ? value +="oui " : value += "non "); value += Tools::prepare(modele->item(row,9)->text()) + " "; value += modele->item(row,1)->text() + " "; value += modele->item(row,2)->text() + " "; if(modele->item(row,8)->data(Qt::CheckStateRole) == QVariant(Qt::Checked)) value += "aleatoire"; else { str = modele->item(row,6)->text(); if(str != "") { value +="heure "+ str.split(":").at(0) + " " + str.split(":").at(1); } else { if(modele->item(row,5)->text() != "") value += "frequence "; else value += "intervalle "; int h = modele->item(row,3)->text().split(":").at(0).toInt(); int m = modele->item(row,3)->text().split(":").at(1).toInt(); time.setHMS(h,m,0); value += time.toString("h m "); h = modele->item(row,4)->text().split(":").at(0).toInt(); m = modele->item(row,4)->text().split(":").at(1).toInt(); time.setHMS(h,m,0); value += time.toString("h m "); if(modele->item(row,5)->text() != "") value += modele->item(row,5)->text(); else value += modele->item(row,7)->text(); } } return value; }
void AddEventos::OtrasHoras() { QObject* obj = QObject::sender(); QRadioButton *RadioBtn = qobject_cast<QRadioButton *>(obj); if(RadioUnaVez==RadioBtn) { HoratoCheckBox(); } if(RadioCadaHora==RadioBtn) w_AddHora->Todos(); if(RadioOtrasHoras==RadioBtn) w_AddHora->exec(); QCheckBox *hora[24]={w_AddHora->H0,w_AddHora->H1,w_AddHora->H2,w_AddHora->H3,w_AddHora->H4, w_AddHora->H5,w_AddHora->H6,w_AddHora->H7,w_AddHora->H8,w_AddHora->H9, w_AddHora->H10,w_AddHora->H11,w_AddHora->H12,w_AddHora->H13,w_AddHora->H14, w_AddHora->H15,w_AddHora->H16,w_AddHora->H17,w_AddHora->H18,w_AddHora->H19, w_AddHora->H20,w_AddHora->H21,w_AddHora->H22,w_AddHora->H23}; int Cuantos=0; for(int i=0;i < 24;i++) if(hora[i]->isChecked()) Cuantos++; //averiguamos cuantos hay if(Cuantos==1) RadioUnaVez->setChecked(true);// SI SOLO es una hora activa radio una vez if(Cuantos==24) RadioCadaHora->setChecked(true);// si son todas activa radio cada hora for(int i=0;i < 24;i++) { if(hora[i]->isChecked())// pone la primera hora como hora de inicio { QTime PrimeraHora; int thora, tminuto, tsegundo; thora=hora[i]->text().toInt(); tminuto=TimeHoraInicio->time().minute(); tsegundo=TimeHoraInicio->time().second(); PrimeraHora.setHMS(thora,tminuto,tsegundo); TimeHoraInicio->setTime(PrimeraHora); return; } //qDebug() <<hora[i]->text(); //qDebug() <<TimeHoraInicio->time().hour(); } }
//========================================================================================== int MainWindow::ReadTimeFromICPDAS(QString IPaddr, QDateTime *icpDT) { int res; modbus_t *mb; uint16_t tab_reg[200]; const uint number_readed_registers=6; uint year=0; uint month=0; uint day=0; uint hour=0; uint minute=0; uint second=0; //inialized context mb = modbus_new_tcp(IPaddr.toStdString().c_str(), 502); if (mb==NULL) {return -1;} res=modbus_connect(mb); modbus_set_slave(mb, 1); if (res==-1) {modbus_free(mb); return -2;} res=modbus_read_registers(mb, 1, number_readed_registers, tab_reg);// 6 reg from 40002 if (res!=number_readed_registers){modbus_close(mb);modbus_free(mb); return -3;} year=tab_reg[0]; month=tab_reg[1]; day=tab_reg[2]; hour=tab_reg[3]; minute=tab_reg[4]; second=tab_reg[5]; QDate dt; dt.setDate(year,month,day); QTime tm; tm.setHMS(hour,minute,second); icpDT->setDate(dt); icpDT->setTime(tm); modbus_close(mb); modbus_free(mb); return 1; }
bool QUnZip::getCurrentFileInfo(QString &name, QDateTime *t /* = NULL */) { if (!isOpen()) { qWarning("QUnZip::getCurrentFileInfo File not open."); return false; } name = ""; unz_file_info fi; if (::unzGetCurrentFileInfo(_d->_unzFile, &fi, NULL, 0 , NULL, 0, NULL, 0) != UNZ_OK) { qWarning("QUnZip::getCurrentFileInfo 1st unzGetCurrentFileInfo failed."); return false; } char *nt; if (fi.size_filename > 0) { nt = new char[fi.size_filename]; Q_CHECK_PTR(nt); } else nt = NULL; if (::unzGetCurrentFileInfo(_d->_unzFile, &fi, nt, fi.size_filename, NULL, 0, NULL, 0) != UNZ_OK) { if (nt) delete []nt; qWarning("QUnZip::getCurrentFileInfo 2nd unzGetCurrentFileInfo failed."); return false; } if (nt) { name.setLatin1(nt, fi.size_filename); delete[] nt; } if (t != NULL) { QDate d; QTime tt; tt.setHMS(fi.tmu_date.tm_hour, fi.tmu_date.tm_min, fi.tmu_date.tm_sec); d.setYMD(fi.tmu_date.tm_year, fi.tmu_date.tm_mon+1, fi.tmu_date.tm_mday); *t = QDateTime(d, tt); } return true; }
Programmation::Programmation(const int id, const QDate &d, const QTime &dur, const QTime &h):id(id),date(d),duree(dur),horaire(h) { ProgManager::Iterator it = ProgManager::getInstance()->getIterator(); int jour = d.day(); /*int debut = h.hour(); int fin = debut + dur.hour();*/ QTime debut=h; QTime fin; fin.setHMS(h.hour()+dur.hour(),h.minute()+dur.minute(),h.second()+dur.second()); /*bool commencePendant=false; bool terminePendant=false;*/ bool horaireinvalide=false; bool memeJour=false; while(it.courant() != ProgManager::getInstance()->end()) { Programmation *p = it.valeur(); /*int pH = p->getHoraire().hour(); int pFin = pH + p->getDuree().hour();*/ int pJour = it.valeur()->getDate().day(); /* commencePendant = (debut >= pH && debut <= pFin); //On autorise qu'un evenement se finisse à une heure h et qu'un autre commence tout de suite après terminePendant = (fin >= pH && fin <= pFin);*/ QTime pDeb=p->getHoraire(); QTime pFin; pFin.setHMS(p->getHoraire().hour()+p->getDuree().hour(),p->getHoraire().minute()+p->getDuree().minute(),p->getHoraire().second()+p->getDuree().second()); /*commencePendant= (debut>=pDeb && debut<pFin); terminePendant= (fin>pDeb && fin<=pFin);*/ horaireinvalide=(debut<=pDeb && fin>=pFin) || (debut<=pDeb && (fin<=pFin && fin>pDeb)) || ((debut>=pDeb && debut<pFin) && fin>=pFin) || ((debut>=pDeb && debut<pFin) && (fin>=pDeb && fin<=pFin)); memeJour = jour == pJour; if( memeJour && horaireinvalide) throw AgendaException("Une programmation occupe déjà une partie de cette plage horaire"); it.next(); } }
a1time Validity::getDate() const { a1time date(dateTime()); QTime time; if (midnight) { time = endDate ? QTime(23,59,59) : QTime(0,0,0); date.setTimeSpec(Qt::UTC); } else { time = date.time(); time.setHMS(time.hour(), time.minute(), 0); } date.setTime(time); return date; }
QTime WavReader::time() { QTime time; int secs = size() / (qreal)wavHeader.samplesPerSec; int minute; int hour; hour = secs / 3600; secs = secs % 3600; minute = secs / 60; secs = secs % 60; time.setHMS(hour, minute, secs); return time; }
void WPSRun::SetTimeDateStarttoCurrent() { //Начинаем с 00:00 текущего дня //Считаем заданный промежуток // QDateTime curStart = QDateTime::fromString("2012-09-15_00:00:00", "yyyy-MM-dd_hh:mm:ss"); // QDateTime curEnd = QDateTime::fromString("2012-09-15_06:00:00", "yyyy-MM-dd_hh:mm:ss"); //Считаем 1 день QDateTime curStart = QDateTime::currentDateTime(); QTime ntime = curStart.time(); ntime.setHMS(GetPrevSrok(ntime.hour()),0,0); curStart.setTime(ntime); //curStart = curStart.addDays(1); // Считаем со следующих суток QDateTime curEnd = curStart.addDays(1); //Одни сутки p_namelist_tool->SetDates(&curStart,&curEnd); }
void VideoWidget::SliderMoved(int newValue) { //Update time display QTime time; int ms = newValue % 1000; int sec = ((newValue - ms) / 1000) % 60; int remainSec = (newValue - sec * 1000 - ms) / 1000; int min = (remainSec / 60) % 60; int remainMin = (remainSec - min * 60) / 60; time.setHMS(remainMin / 60, min, sec, ms); this->ui->timeEdit->setTime(time); this->SetVisibleAtTime(newValue); }
ExtDateTime millisecondsToExtDateTime(double ms) { ExtDateTime edt; edt.setTime_t(0); if (ms > 0.0) { double milli = fmod(ms, 1000.0); ms = (ms - milli) / 1000.0; assert(ms < 60*365*24*60*60); // we can't handle big dates yet // this will have to change when we do edt.setTime_t(int(ms)); QTime t = edt.time(); t.setHMS(t.hour(), t.minute(), t.second(), int(milli)); edt.setTime(t); } if (ms < 0.0) { abort(); // unhandled at this point } return edt; }
void Log::showPeticiones(){ this->limpiarLabel(); std::string owner=ui->comboOwnerFilter->currentText().toStdString(); criterio.setOwner(owner); std::string oficina=ui->comboOficinaFilter->currentText().toStdString(); criterio.setOficina(oficina); std::string continente=ui->comboContinenteFilter->currentText().toStdString(); criterio.setContinente(continente); std::string pais=ui->comboPais->currentText().toStdString(); criterio.setPais(pais); std::string estado=ui->comboEstado->currentText().toStdString(); qDebug()<<"current estado" << ui->comboEstado->currentText(); criterio.setAceptada(estado); bool fechaActivada=false; fechaActivada=ui->checkFecha->checkState(); QTime time; time.setHMS(01,01,01); QDateTime fecha; if(fechaActivada==true){ ui->dateFechaFilter->setEnabled(true); ui->labelFechaFilter->setEnabled(true); QDate date; date=ui->dateFechaFilter->date(); fecha.setDate(date); fecha.setTime(time); criterio.setPeticion(fecha); }else{ ui->dateFechaFilter->setEnabled(false); ui->labelFechaFilter->setEnabled(false); QDate date; date.setDate(1900,01,01); fecha.setDate(date); fecha.setTime(time); criterio.setPeticion(fecha); } rellenarTabla(controller_->getPeticiones(), ui->tablePeticiones, &criterio); }
QString FormatCallDuration(int seconds) { int minutes = 0; int hours = 0; if (seconds >= 3600) { hours = seconds / 3600; seconds = seconds % 3600; } if (seconds >= 60) { minutes = seconds / 60; seconds = seconds % 60; } QTime *time = new QTime(); time->setHMS(hours, minutes, seconds, 0); return time->toString("hh:mm:ss"); }
ExtDateTime ExtDateTime::fromString( const QString& s, Qt::DateFormat f ) { ExtDateTime dt; if ( ( s.isEmpty() ) || ( f == Qt::LocalDate ) ) { #if defined(QT_CHECK_RANGE) qWarning( "ExtDateTime::fromString: Parameter out of range" ); #endif dt.d.setJD( INVALID_DAY ); return dt; } if ( f == Qt::ISODate ) { if ( s.length() <= 10 || ! s.contains( ':' ) ) { //no time specified QTime t = QTime(0,0,0); return ExtDateTime( ExtDate::fromString( s.mid(0,10), Qt::ISODate ) ); } else { return ExtDateTime( ExtDate::fromString( s.mid(0,10), Qt::ISODate ), QTime::fromString( s.mid(11), Qt::ISODate ) ); } } #if !defined(QT_NO_REGEXP) && !defined(QT_NO_TEXTDATE) else if ( f == Qt::TextDate ) { //parse the time, if it exists. QTime time; QString sd = s; int hour, minute, second; int pivot = s.find( QRegExp(QString::fromLatin1("[0-9][0-9]:[0-9][0-9]:[0-9][0-9]")) ); if ( pivot != -1 ) { hour = s.mid( pivot, 2 ).toInt(); minute = s.mid( pivot+3, 2 ).toInt(); second = s.mid( pivot+6, 2 ).toInt(); time.setHMS( hour, minute, second ); sd = s.left( pivot - 1 ); } //sd is now just the date string. ExtDate date = ExtDate::fromString( s, Qt::TextDate ); return ExtDateTime( date, time ); } #endif //QT_NO_REGEXP return ExtDateTime(); }
void CtimerProperty::setSettingsToWidget(QString str) { int year,month,day,hour,min,sec; QDate date; QTime time; disconnectSignal(); settings.beginGroup(str); int type = settings.value("type").toInt(); if(type EQ TIMER_PROPERTY) { year = settings.value("dstYear").toInt(); month = settings.value("dstMon").toInt(); day = settings.value("dstDay").toInt(); date.setDate(year, month, day); dstDateTimeEdit->setDate(date); hour = settings.value("dstHour").toInt(); min = settings.value("dstMin").toInt(); sec = settings.value("dstSec").toInt(); time.setHMS(hour, min, sec, 0); dstDateTimeEdit->setTime(time); colorCombo->setCurrentIndex(settings.value("color").toInt()); styleCombo->setCurrentIndex(settings.value("style").toInt()); fontSizeCombo->setCurrentIndex(settings.value("size").toInt()); } else ASSERT_FAILED(); settings.endGroup(); if(type EQ TIMER_PROPERTY) { nameEdit->setSettingsToWidget(str); simpleTextEdit->setSettingsToWidget(str); smLineEdit->setSettingsToWidget(str); showModeEdit->setSettingsToWidget(str); borderEdit->setSettingsToWidget(str); } else ASSERT_FAILED(); connectSignal(); }
void ChimeryMainWindow::reinit() { // Reinit widgets QTime rcur = QTime::currentTime(); rcur.setHMS(rcur.hour(), rcur.minute() - (rcur.minute() % 5) + 5, 0); cycStart->setTime(rcur); cycNum->setValue(8); cycDur->setValue(50); // Reinit state timer->stop(); cyc(); refresh(); systray->hide(); menus->sched_stop(); this->show(); QGuiApplication::setQuitOnLastWindowClosed(true); }
void MainWindow::on_horizontalSlider_2_valueChanged(int value) { // minutes slider if(0 == ui->comboBox->currentIndex()) { QTime form_tm = ui->timeEdit->time(); QTime tm; tm.setHMS(form_tm.hour(),value,form_tm.second(),0); ui->timeEdit->setTime(tm); } if(1 == ui->comboBox->currentIndex()) { //ui->spinBox->setValue(value); ui->spinBox_2->setValue(value); } }
void TimeSetDialog::timeResetSlot() { qDebug()<<"in 1 time reset slot"; QDate tmpDate; QTime tmpTime; QProcess *dateProcess = new QProcess(this); QStringList hwClockSetArgs; tmpDate.setDate(yearSpinBox->value(),monthSpinBox->value(),daySpinBox->value()); tmpTime.setHMS(hourSpinBox->value(),minuteSpinBox->value(),secondSpinBox->value()); nDateTime.setDate(tmpDate); nDateTime.setTime(tmpTime); qDebug()<<"in 2 time reset "; hwClockSetArgs <<"-s"; hwClockSetArgs << nDateTime.toString("MMddhhmmyyyy.ss"); dateProcess->start("date",hwClockSetArgs); dateProcess->waitForFinished(3); qDebug()<<"in 3 time reset "; hwClockSetArgs.clear(); hwClockSetArgs<<"-w"; dateProcess->start("hwclock",hwClockSetArgs); dateProcess->waitForFinished(3); qDebug()<<"time reset successfully!"; QMessageBox *box = new QMessageBox(tr("time reset"), tr("Great ,time reset successfully O(∩_∩)O~!"), QMessageBox::Information, QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton, this); box->setAttribute(Qt::WA_DeleteOnClose); connect(this->parentWidget(), SIGNAL(closedialog()), box, SLOT(close())); box->exec(); yearSpinBox->setValue(nDateTime.date().year()); monthSpinBox->setValue(nDateTime.date().month()); daySpinBox->setValue(nDateTime.date().day()); hourSpinBox->setValue(nDateTime.time().hour()); minuteSpinBox->setValue(nDateTime.time().minute()); secondSpinBox->setValue(nDateTime.time().second()); delete(dateProcess); emit setSuccessful(); }
const QTime ADBColumn::toQTime(int useBackup) { if (intDataType != FIELD_TYPE_TIME ) ADBLogMsg(LOG_WARNING, "ADBColumn::toQDate(%d) - Warning! Column is not a date", intColumnNo); QTime retVal; QString tmpQStr; if (useBackup) tmpQStr = intOldData; else tmpQStr = intData; retVal.setHMS( tmpQStr.mid(0,2).toInt(), tmpQStr.mid(3,2).toInt(), tmpQStr.mid(6,2).toInt() ); return (const QTime) retVal; }
void SettingsWidget::slotDetAdjustmentByClockPhoto() { // Determine the currently selected item and preselect it as clock photo QUrl defaultUrl; if (d->imageList) { defaultUrl = d->imageList->getCurrentUrl(); } /* When user press the clock photo button, a dialog is displayed and set the * results to the proper widgets. */ QPointer<ClockPhotoDialog> dlg = new ClockPhotoDialog(this, defaultUrl); const int result = dlg->exec(); if (result == QDialog::Accepted) { DeltaTime dvalues = dlg->deltaValues(); if (dvalues.isNull()) { d->adjTypeChooser->setCurrentIndex(TimeAdjustSettings::COPYVALUE); } else if (dvalues.deltaNegative) { d->adjTypeChooser->setCurrentIndex(TimeAdjustSettings::SUBVALUE); } else { d->adjTypeChooser->setCurrentIndex(TimeAdjustSettings::ADDVALUE); } d->adjDaysInput->setValue(dvalues.deltaDays); QTime deltaTime; deltaTime.setHMS(dvalues.deltaHours, dvalues.deltaMinutes, dvalues.deltaSeconds); d->adjTimeInput->setTime(deltaTime); } delete dlg; }