开发者

How to Set Time in QTimeEdit at Run Time in QT?

How to Set Time in QTimeEdit at Run开发者_Python百科 Time in QT ?

Like I want to Show 17:30 in QtimeEdit.

Thanks.


http://doc.qt.io/qt-5/qdatetimeedit.html#time-prop What exactly did you not understand?

example:

QTime time(17, 30);
QTimeEdit te;
te.setTime(time);


You can use the following methods:

  • setTime ( const QTime & )
  • setTimeRange ( const QTime &, const QTime & )
  • setTimeSpec ( Qt::TimeSpec )

e.g.:

this->time_edit->setTime(QTime(10,17));


You can apply:

bool QTime::setHMS ( int h, int m, int s, int ms = 0 )

QTime tm;
tm.setHMS(10,25,45,0);

The result will be "10:25:45"

Cheers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜