本文整理汇总了C++中QTime::minute方法的典型用法代码示例。如果您正苦于以下问题:C++ QTime::minute方法的具体用法?C++ QTime::minute怎么用?C++ QTime::minute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTime
的用法示例。
在下文中一共展示了QTime::minute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updatePrimitives
/*!
@copydoc HbWidget::updatePrimitives()
*/
void SnsrOledClockWidget::updatePrimitives()
{
if (!mClockHourHand || !mClockMinuteHand || !mClockAmPmLabel) {
createPrimitives();
}
Q_ASSERT( mClockHourHand && mClockMinuteHand && mClockAmPmLabel );
// Calculate angles for clock hands.
// Use granularity of one minute so that minute hand is always exactly
// on some minute and not between minutes. OLED clock is not updated more
// frequently than once per minute and using finer granularity would cause
// the minute hand to be always between even minutes.
QTime time = QTime::currentTime();
qreal m = 6 * time.minute();
qreal h = 30 * ((time.hour() % 12) + m/360);
int x = mClockHourHand->preferredSize().width()/2;
int y = mClockHourHand->preferredSize().height()/2;
mClockHourHand->setTransform(QTransform().translate(x, y).rotate(h).translate(-x, -y));
x = mClockMinuteHand->preferredSize().width()/2;
y = mClockMinuteHand->preferredSize().height()/2;
mClockMinuteHand->setTransform(QTransform().translate(x, y).rotate(m).translate(-x, -y));
QString amPmString = (time.hour()<12) ? HbExtendedLocale().amText() : HbExtendedLocale().pmText();
mClockAmPmLabel->setText( amPmString );
}
示例2: QDateTimeToDATE
static DATE QDateTimeToDATE(const QDateTime &dt)
{
if (!dt.isValid() || dt.isNull())
return 949998;
SYSTEMTIME stime;
memset(&stime, 0, sizeof(stime));
QDate date = dt.date();
QTime time = dt.time();
if (date.isValid() && !date.isNull()) {
stime.wDay = date.day();
stime.wMonth = date.month();
stime.wYear = date.year();
}
if (time.isValid() && !time.isNull()) {
stime.wMilliseconds = time.msec();
stime.wSecond = time.second();
stime.wMinute = time.minute();
stime.wHour = time.hour();
}
double vtime;
SystemTimeToVariantTime(&stime, &vtime);
return vtime;
}
示例3: setInterval
void Timelapse::setInterval(const QTime &time){
intervalTime->setHMS(time.hour(),time.minute(),time.second(),time.msec());
realinterval = interval = time.second()*1000+time.msec();
LOG_TIMELAPSE_DEBUG << "Timelapse setInterval: " << time.second() << time.msec() << interval;
timer->setInterval(timerresolution);
}
示例4: paintSection
void QxtScheduleHeaderWidget::paintSection(QPainter * painter, const QRect & rect, int logicalIndex) const
{
if (model())
{
switch (orientation())
{
case Qt::Horizontal:
{
QHeaderView::paintSection(painter, rect, logicalIndex);
}
break;
case Qt::Vertical:
{
QTime time = model()->headerData(logicalIndex, Qt::Vertical, Qt::DisplayRole).toTime();
if (time.isValid())
{
QRect temp = rect;
temp.adjust(1, 1, -1, -1);
painter->fillRect(rect, this->palette().background());
if (time.minute() == 0)
{
painter->drawLine(temp.topLeft() + QPoint(temp.width() / 3, 0), temp.topRight());
painter->drawText(temp, Qt::AlignTop | Qt::AlignRight, time.toString("hh:mm"));
}
}
}
break;
default:
Q_ASSERT(false); //this will never happen... normally
}
}
}
示例5: timeToMins
int SessionDefaults::timeToMins(const QTime &time) const
{
int hour = time.hour();
int min = time.minute();
return hour * 60 + min + 1;
}
示例6: sipNoMethod
static PyObject *meth_QTime_toPyTime(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QTime *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QTime, &sipCpp))
{
PyObject * sipRes = 0;
#line 299 "/home/tsheasha/GUC/Bachelors/android-python27/python-build/PyQt-x11-gpl-4.8/sip/QtCore/qdatetime.sip"
if (!PyDateTimeAPI)
PyDateTime_IMPORT;
// Convert to a Python time object.
sipRes = PyTime_FromTime(sipCpp->hour(), sipCpp->minute(), sipCpp->second(), sipCpp->msec() * 1000);
#line 74 "sipQtCoreQTime.cpp"
return sipRes;
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QTime, sipName_toPyTime, NULL);
return NULL;
}
示例7: handleSliderMove
void TourWidget::handleSliderMove( int value )
{
d->m_playback.seek( value / 100.0 );
QTime nullTime( 0, 0, 0 );
QTime time = nullTime.addSecs( value / 100.0 );
d->m_tourUi.m_elapsedTime->setText( QString("%L1:%L2").arg( time.minute(), 2, 10, QChar('0') ).arg( time.second(), 2, 10, QChar('0') ) );
}
示例8: subTime
void KTimeEdit::subTime(QTime qt)
{
int h, m;
// Note that we cannot use the same method for determining the new
// time as we did in addTime, because QTime does not handle adding
// negative seconds well at all.
h = mTime.hour() - qt.hour();
m = mTime.minute() - qt.minute();
if(m < 0)
{
m += 60;
h -= 1;
}
if(h < 0)
{
h += 24;
}
// store the newly calculated time.
mTime.setHMS(h, m, 0);
updateText();
emit timeChanged(mTime);
}
示例9: addLineToAdvTranscript
void cTranscript::addLineToAdvTranscript (cTextChunk *chunk)
{
if (!advrunning)
return;
QString timestamp;
if (includetimestamp)
{
QTime time = QTime::currentTime ();
timestamp.sprintf ("[%02d:%02d:%02d.%02d] ", time.hour(), time.minute(), time.second(), time.msec() / 10);
fputs (timestamp.toLatin1(), advfile);
}
cANSIParser *ap = dynamic_cast<cANSIParser *>(object ("ansiparser"));
QString s;
switch (advtype) {
case TRANSCRIPT_PLAIN: s = chunk->toText (); break;
case TRANSCRIPT_ANSI: s = chunk->toAnsi (ap); break;
case TRANSCRIPT_HTML: s = chunk->toHTML (); break;
};
QByteArray b = s.toLocal8Bit ();
const char *ch = b.constData();
if (ch)
fputs (ch, advfile);
fflush (advfile);
}
示例10: QTime
int Tano::Xmltv::timeZoneDiff()
{
QDateTime local = QDateTime::currentDateTime();
local.setTime(QTime(0, 0));
QDateTime utc = local.toUTC();
local.setTimeSpec(Qt::LocalTime);
QDateTime offset = local.toUTC();
QTime properTimeOffset = QTime(offset.time().hour(), offset.time().minute());
offset.setTimeSpec(Qt::LocalTime);
utc.setTimeSpec(Qt::UTC);
bool isNegative;
if (offset.secsTo(utc) < 0) {
isNegative = true;
} else {
isNegative = false;
properTimeOffset.setHMS(24 - properTimeOffset.hour() - (properTimeOffset.minute()/60.0) - (properTimeOffset.second()/3600.0), properTimeOffset.minute() - (properTimeOffset.second()/60.0), properTimeOffset.second());
if (!properTimeOffset.isValid()) { //Midnight case
properTimeOffset.setHMS(0,0,0);
}
}
if (isNegative)
return properTimeOffset.secsTo(QTime(0, 0));
else
return - properTimeOffset.secsTo(QTime(0, 0));
}
示例11: setModelData
void TrackDelegate::setModelData(QWidget *editor,
QAbstractItemModel *model,
const QModelIndex &index) const
{
if ( !index.isValid())
{
return;
}
QTimeEdit* timeEditor = qobject_cast<QTimeEdit*>(editor);
if ( !timeEditor)
{
return;
}
if (isRightColumn(index, TrackDelegate::columnNumber))
{
QTime time = timeEditor->time();
int secs = time.hour() * 60 + time.minute();
//int secs = index.model()->data(index, Qt::EditRole).toInt();
model->setData(index, secs, Qt::EditRole);
}
else
{
QStyledItemDelegate::setModelData(editor, model, index);
}
}
示例12: updateTimer
void MainWindow::updateTimer()
{
int milisegundos, segundos, minutos;
QTime timeAct = QTime::currentTime();
int minInicial = timeInicial.minute();
int minActual = timeAct.minute();
int segInicial = timeInicial.second();
int segActual = timeAct.second();
int msegInicial = timeInicial.msec();
int msegActual = timeAct.msec();
if (msegActual < msegInicial){
msegActual = 1000 + msegActual;
segActual = segActual -1;
}
if (segActual < segInicial){
segActual = 60 + segActual;
minActual = minActual -1;
}
minutos = minActual - minInicial;
segundos = segActual - segInicial;
milisegundos = (msegActual - msegInicial);
QTime *time = new QTime(0,minutos,segundos,milisegundos);
textTiempo = time->toString("mm:ss.zzz");
valorTiempo = milisegundos + segundos*1000 + minutos *60000;
ui->lcdNumber->display(textTiempo);
}
示例13: timeValueChanged
// -------------------------------------------------------------------------------------------------
void ParameterBox::timeValueChanged(const QTime& time)
throw ()
{
Settings& set = Settings::set();
set.writeEntry("Measuring/Triggering/Minutes", time.minute());
set.writeEntry("Measuring/Triggering/Seconds", time.second());
}
示例14: log
/*
Log to the logfile only.
*/
void cLog::log( eLogLevel loglevel, cUOSocket* sock, const QString& string, bool timestamp )
{
if ( !( Config::instance()->logMask() & loglevel ) )
{
return;
}
// -> Log Event
cPythonScript *globalHook = ScriptManager::instance()->getGlobalHook(EVENT_LOG);
if (globalHook && globalHook->canHandleEvent(EVENT_LOG)) {
PyObject *args = Py_BuildValue("(iNNO)", (unsigned int)loglevel, PyGetSocketObject(sock), QString2Python(string), Py_None );
bool result = globalHook->callEventHandler(EVENT_LOG, args);
Py_DECREF(args);
if (result) {
return;
}
}
if ( !checkLogFile() )
return;
// Timestamp the data
QTime now = QTime::currentTime();
QString prelude;
if ( timestamp || loglevel == LOG_PYTHON )
{
prelude.sprintf( "%02u:%02u:", now.hour(), now.minute() );
if ( sock )
prelude.append( QString( "%1:" ).arg( sock->uniqueId(), 0, 16 ) );
}
// LogLevel
switch ( loglevel )
{
case LOG_ERROR:
prelude.append( " ERROR: " );
break;
case LOG_WARNING:
prelude.append( " WARNING: " );
break;
case LOG_PYTHON:
prelude.append( " PYTHON: " );
break;
default:
prelude.append( " " );
}
QByteArray utfdata = string.toUtf8();
utfdata.prepend( prelude.toUtf8() );
logfile.write( utfdata );
logfile.flush();
}
示例15: absolutetime_changed
void UI_JumpMenuDialog::absolutetime_changed(const QTime &time_2)
{
long long milliseconds;
if(!mainwindow->files_open) return;
QObject::disconnect(daybox1, SIGNAL(valueChanged(int)), this, SLOT(offsetday_changed(int)));
QObject::disconnect(timeEdit1, SIGNAL(timeChanged(const QTime &)), this, SLOT(offsettime_changed(const QTime &)));
milliseconds = (long long)(time_2.hour()) * 3600000LL;
milliseconds += (long long)(time_2.minute()) * 60000LL;
milliseconds += (long long)(time_2.second()) * 1000LL;
milliseconds += (long long)(time_2.msec());
milliseconds += ((long long)daybox2->value() * 86400000LL);
if(milliseconds<0) milliseconds = 0;
milliseconds -= starttime;
time1.setHMS((int)((milliseconds / 3600000LL) % 24LL), (int)((milliseconds % 3600000LL) / 60000LL), (int)((milliseconds % 60000LL) / 1000LL), (int)(milliseconds % 1000LL));
timeEdit1->setTime(time1);
daybox1->setValue((int)(milliseconds / 86400000LL));
QObject::connect(daybox1, SIGNAL(valueChanged(int)), this, SLOT(offsetday_changed(int)));
QObject::connect(timeEdit1, SIGNAL(timeChanged(const QTime &)), this, SLOT(offsettime_changed(const QTime &)));
}