本文整理汇总了C++中DTime::totalMinutes方法的典型用法代码示例。如果您正苦于以下问题:C++ DTime::totalMinutes方法的具体用法?C++ DTime::totalMinutes怎么用?C++ DTime::totalMinutes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DTime
的用法示例。
在下文中一共展示了DTime::totalMinutes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getTaskItem
void LogScene::getTaskItem(const QModelIndex &index) {
Task* task = _model->task(index);
Calendar* calendar = task->project()->projectDefaultCalendar();
int hoursInDay = calendar->endHour().hour() - calendar->startHour().hour();
std::vector<TaskLog*>* logs =task->logs();
double startHour = 0;//calendar->startHour().hour();
double endHour = 24;//calendar->endHour().hour() + 1;
double minuteSize = (double)24*BLOCKSIZE / (double)((endHour - startHour) * 60);
int red = 0;
for (std::vector<TaskLog*>::iterator iter = logs->begin(); iter != logs->end(); iter++) {
TaskLog* log = *iter;
QSize size = sizeHint(index);
int bordermargin = (size.height() * .4) / 2;
int daysToStart = _startDate.daysTo(*log->start);
double x1 = (double)daysToStart * (double)_dayWidth;
DTime logStartTime = log->start->time();
double y1 = (double)(logStartTime.totalMinutes() - (startHour*60)) * minuteSize;
double x2 = (daysToStart + 1) * (double)_dayWidth;
DTime logEndTime = log->end->time();
if (log->end->getDay() != log->start->getDay()) {
logEndTime = DTime(23, 59, 59);
}
double y2 = (double)(logEndTime.totalMinutes() - (startHour*60)) * minuteSize;
QBrush b(task->taskColor());//QImage(":/img/task_bar.png"));//(QPixmap(":/img/task_bar.png"));
red += 20;
QColor penColor((task->taskColor().red() < 100) ? 0: (task->taskColor().red() - 100),
(task->taskColor().green() < 100) ? 0: (task->taskColor().green() - 100),
(task->taskColor().blue() < 100) ? 0: (task->taskColor().blue() - 100));
QPen pen(penColor);
if (log->activeLog) {
pen.setWidth(3);
}
QGraphicsItem* item = this->addRect(x1, y1, (x2 - x1), (y2 - y1), pen, b);
item->setZValue(1);
if ((y2 - y1) > 20) {
QFont f("Arial", 8);
f.setWeight(QFont::Light);
QBrush brush(penColor);
std::string description = *task->shortDescription();
int textY = y1 + 5;
while (description.length() > 0) {
std::string label;
if (description.length() > 15) {
label = description.substr(0, 15);
description = description.substr(15);
if ((label.at(label.length() - 1) != ' ') &&
(description.at(0) != ' ')) {
int pos;
if ((pos = label.rfind(' ')) != std::string::npos) {
description = label.substr(pos) + description;
label = label.substr(0, pos);
}
}
} else {
label = description;
description = "";
}
label = label.erase(label.find_last_not_of(" \n\r\t")+1);
description = description.erase(description.find_last_not_of(" \n\r\t")+1);
if ((textY + 20) < y2) {
QGraphicsSimpleTextItem* text = this->addSimpleText(tr(label.c_str()));
text->setPos(x1 + 10, textY);
//text->rotate(90);
text->setVisible(true);
text->setBrush(brush);
text->setFont(f);
text->setZValue(2);
textY += 15;
} else {
break;
}
}
}
_currentY += sizeHint(index).height();
}
delete(logs);
}