本文整理汇总了C++中QTimeEdit::pos方法的典型用法代码示例。如果您正苦于以下问题:C++ QTimeEdit::pos方法的具体用法?C++ QTimeEdit::pos怎么用?C++ QTimeEdit::pos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTimeEdit
的用法示例。
在下文中一共展示了QTimeEdit::pos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: timesChanged
void MainWindow::timesChanged(QTime t) {
//when time edit event occur
return;
QWidget *wid = QApplication::focusWidget();
QTimeEdit *cell = qobject_cast<QTimeEdit*>(wid);
QTimeEdit *st;
QTimeEdit *et;
QSpinBox *du;
int start, end;
if (wid) {
QModelIndex index = widget.tableWidget->indexAt(cell->pos());
// cout << index.row() << " " << index.column() << endl;
if (index.column() == 0) {
st = cell;
et = qobject_cast<QTimeEdit*>(widget.tableWidget->cellWidget(index.row(), 1));
} else {
et = cell;
st = qobject_cast<QTimeEdit*>(widget.tableWidget->cellWidget(index.row(), 0));
}
QTime tt;
tt = st->time();
start = tt.msec() + 1000 * (tt.second() + tt.minute()*60 + tt.hour()*3600);
tt = et->time();
end = tt.msec() + 1000 * (tt.second() + tt.minute()*60 + tt.hour()*3600);
if (start > end) {
if (index.column() == 0) {
// st->setTime(et->time());
} else {
// et->setTime(st->time());
}
}
du = qobject_cast<QSpinBox*>(widget.tableWidget->cellWidget(index.row(), 2));
du->setValue(end - start);
delete wid;
delete cell;
delete et;
delete st;
delete du;
}
}