我正在尝试设置两个 timeEdits:“timeEdit”和“timeEdit_2”。"timeEdit_2" 取当前时间如下:
ui->timeEdit_2->setTime(QTime::currentTime());
同时,“timeEdit”应该比“timeEdit_2”早一个小时。所以我正在做以下事情:
int hour = (QTime::currentTime().hour())-1;
int minutes = QTime::currentTime().minute();
int second = QTime::currentTime().second();
QTime time = QTime::setHMS(hour, minutes,second);
ui->timeEdit->setTime(QTime(time));
但我收到此错误:
erroe:cannot call member function 'bool QTime::setHMS(int, int, int, int)' without object
如何创建这个对象?