first re-commit.
This commit is contained in:
58
raDIYoglobals.cpp
Normal file
58
raDIYoglobals.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
/***************************************************************************
|
||||
|
||||
source::worx raDIYo
|
||||
Copyright © 2020-2022 c.holzheuer
|
||||
chris@sourceworx.org
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <raDIYoglobals.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief liest einen String aus den Resourcen und gibt ihn zurück
|
||||
* @param fileName Der Bezeichner
|
||||
* @return
|
||||
*/
|
||||
|
||||
QString readResource( const QString& fileName )
|
||||
{
|
||||
|
||||
QFile resourceFile( fileName );
|
||||
|
||||
if( !resourceFile.open( QFile::ReadOnly | QFile::Text) )
|
||||
return resourceFile.errorString();
|
||||
|
||||
QTextStream in( &resourceFile );
|
||||
QString text = in.readAll();
|
||||
resourceFile.close();
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief formatInt: Formatiert einen Integer in einen QString
|
||||
* @param value der Zahlenwert
|
||||
* @param len die Anzeigelänge
|
||||
*/
|
||||
|
||||
QString formatInt(int value, int len )
|
||||
{
|
||||
QString result( "%0" );
|
||||
result = result.arg( value, len, 10, QChar( '0' ) );
|
||||
return result;
|
||||
}
|
Reference in New Issue
Block a user