MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{    
    ui->setupUi(this);
    ui->label->setText("");
    num=0;
    QTimer *time=new QTimer(this);
 
    connect(time,SIGNAL(timeout()),this,SLOT(UpdateText()));
    time->start(100);
}
void MainWindow::UpdateText()
{
    QDate date = QDate::currentDate();
    QTime time=QTime::currentTime();
    QString str =date.toString("yyyy-MM-dd  ")+ time.toString("hh:mm:ss");
    ui->label->setText(str);
}
05-30 18:09