---------------------------------------------------
#include "mainwindow.h"
#include "ui_mainwindow.h"
QDateTime ora;
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
ora = QDateTime::currentDateTime();
ui->dateTimeEdit->setDateTime(ora);
ui->label_ora->setText(ora.toString());
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pushButton_clicked()
{
QDateTime partenza = ui->dateTimeEdit->dateTime();
int diff = ora.secsTo(partenza);
QString qStr = QString::number(diff);
ui->label->setText("Diff.secondi : " +qStr);
}
---------------------------------------------------
Nessun commento:
Posta un commento