Qt Tips&Tricks

Passwort in MD5-Hash umrechnen

QByteArray password;
password.append( QString("geheim") );
QString md5 = QCryptographicHash::hash(password, QCryptographicHash::Md5).toHex();




Get the current logged-in user

QString username = readFromConfig();
if (username.isEmpty()) {
#ifdef Q_OS_WIN32
  username = QProcessEnvironment::systemEnvironment().value("USERNAME");
#else
  username = QProcessEnvironment::systemEnvironment().value("USER");
#endif
}