diff --git a/mainwindow.cpp b/mainwindow.cpp index 7a8e0ab..52fea4e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -194,5 +194,5 @@ QString MainWindow::generateCode(QString key) { p = CppTotp::totp(qui, time(NULL), 0, 30, 6); // return only the first six digits, as a string, with a space in the middle - return QString::number(p).left(6).replace(QRegularExpression(R"((\d{3})(\d{3}))"), R"(\1 \2)"); + return QString::number(p).rightJustified(6, '0', true).replace(QRegularExpression(R"((\d{3})(\d{3}))"), R"(\1 \2)"); }