This article mainly introduces the example of qt countdown implementation. For more information, see
The countdown program written with Qt can be used for different purposes according to the specified time. Create a simple GUI project for Qt and modify main. cpp.
Copy the Code as follows:
# Include
# Include
# Include
# Include
Int main (int argc, char * argv [])
{
QApplication a (argc, argv );
QLabel * label = new QLabel;
QDate currentDate = QDate: currentDate ();
QDate kaoyanri (, 7 );
Qint64 tianshui = currentDate. daysTo (kaoyanri );
QString tianshu = QString: number (tianshui );
QString string ("coming soon ");
QString tian ("day ");
String = string + tianshu + tian;
Label-> setText (string );
Label-> setWindowTitle ("Countdown to postgraduate entrance exam ");
QFont font;
Font. setPointSize (30 );
Label-> setFont (font );
Label-> resize );
Label-> show ();
Return a.exe c ();
}
Note: For more exciting articles, please follow the help houseProgramming TutorialTopic.