{"id":19000679,"url":"https://github.com/flaviomarcio/qstm","last_synced_at":"2026-07-01T00:32:13.312Z","repository":{"id":209546357,"uuid":"415734717","full_name":"flaviomarcio/qstm","owner":"flaviomarcio","description":"Qt-QStm, set of classes and utilities for configuring and working with Qt/QVariant/JSON types.","archived":false,"fork":false,"pushed_at":"2024-02-13T03:23:49.000Z","size":524,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-17T03:43:16.929Z","etag":null,"topics":["converter","cpp","formatting","qt","setting","utilities"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flaviomarcio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-10-11T00:42:50.000Z","updated_at":"2023-11-27T22:16:50.000Z","dependencies_parsed_at":"2024-02-13T04:38:20.997Z","dependency_job_id":null,"html_url":"https://github.com/flaviomarcio/qstm","commit_stats":null,"previous_names":["flaviomarcio/qstm"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flaviomarcio/qstm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviomarcio%2Fqstm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviomarcio%2Fqstm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviomarcio%2Fqstm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviomarcio%2Fqstm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flaviomarcio","download_url":"https://codeload.github.com/flaviomarcio/qstm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flaviomarcio%2Fqstm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34988712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-30T02:00:05.919Z","response_time":92,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","cpp","formatting","qt","setting","utilities"],"created_at":"2024-11-08T18:08:07.357Z","updated_at":"2026-07-01T00:32:13.284Z","avatar_url":"https://github.com/flaviomarcio.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QStm\n\n**Set of classes and utilities for configuring and working with Qt types.**\n\n\n## Working architecture\n\n\u003e## Support\n\u003e Qt5, Qt6\n\n## Prerequisits\n\u003e```bash\n\u003e mkdir myproject;\n\u003e cd myproject;\n\u003e git clone git@github.com:flaviomarcio/qstm.git;\n\u003e```\n\u003eCheck example in QStm/example/*\n\n\n## CMake Build information\n\n\u003e```\n\u003e## initial CMake parameters \n\u003e\n\u003e-GNinja\n\u003e-DCMAKE_BUILD_TYPE:STRING=Debug\n\u003e-DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake\n\u003e-DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}\n\u003e-DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}\n\u003e-DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}\n\u003e-DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}\n\u003e-DCMAKE_INSTALL_PREFIX=~/build/myproject/install/Debug\n\u003e```\n\n\u003e```bash\n\u003e cd qstm\n\u003e mkdir build;\n\u003e cd build;\n\u003e cmake ..\n\u003e make;\n\u003e make install;\n\u003e```\n\n## QMake Build information\n\n\u003e```bash\n\u003e cd qstm\n\u003e qmake qstm.pro\n\u003e make;\n\u003e make install;\n\u003e ls -l;\n\u003e```\n\n## Configure QMake project\n\n\u003e```c++\n\u003eCONFIG += c++17\n\u003eCONFIG += console\n\u003eCONFIG += silent\n\u003eCONFIG -= debug_and_release\n\u003eQT += gui core widgets\n\u003e\n\u003eTEMPLATE = app\n\u003eTARGET = demo\n\u003e\n\u003einclude($$PWD/../../../qstm/qstm.pri)\n\u003e```\n\n## Classes\n\n\u003e## QStm::MetaObjectUtil\n\u003eClass contains functions to convert create ***QObject*** using ***QMetaObject*** read ***QMetaProperty*** and set in ***QVariant*** and write in ***QMetaProperty*** using ***QVariant*** or ***JSON*** \n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003evoid run()\n\u003e{\n\u003e     ...more\n\u003e}\n\u003e```\n\u003e## QStm::ResultValue\n\u003eBased on ***QObject***, use for simultaneous transport of values ​​and function result.\n\u003eAvoid instances of classes using New, she transport values ​​with no need to create classes.\n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003eclass SimpleObject : public QStm::Object {\n\u003e    Q_OBJECT\n\u003epublic:\n\u003e    ResultValue\u0026hashMd5(const QVariant\u0026bytes)\n\u003e    {\n\u003e        if(bytes.isNull())\n\u003e            return this-\u003elr()=false;//return false and without error\n\u003e\n\u003e        if(bytes.toString().trimmed().isEmpty())\n\u003e            return this-\u003elr().setBadRequest(\"Invalid data\");//return false and with error\n\u003e\n\u003e        QStm::VariantUtil vu;\n\u003e        QVariant md5=vu.toByteArray(bytes);\n\u003e        return this-\u003elr(md5);//return success and return value\n\u003e    }\n\u003e};\n\u003e\n\u003evoid check()\n\u003e{\n\u003e    SimpleObject simpleObject;\n\u003e\n\u003e    QByteArray bytes(\"1234567890\");\n\u003e\n\u003e    if(!simpleObject.hashMd5(bytes)){\n\u003e        qWarning()\u003c\u003csimpleObject.lr().returnCode();//error code\n\u003e        qWarning()\u003c\u003csimpleObject.lr().returnText();//error text\n\u003e        return;\n\u003e    }\n\u003e    \n\u003e    qWarning()\u003c\u003csimpleObject.lr().resultByteArray();\n\u003e}\n\u003e```\n\u003eOthers conversion basead in QVariant\n\u003e```c++\n\u003e//to bytes\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultByteArray();\n\u003e\n\u003e//to int\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultInt();\n\u003e\n\u003e//to Double\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultDouble();\n\u003e\n\u003e//to QString\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultString();\n\u003e\n\u003e//to QDate\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultDate();\n\u003e\n\u003e//to QTime\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultTime();\n\u003e\n\u003e//to QDateTime\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultDateTime();\n\u003e\n\u003e//to QUrl\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultUrl();\n\u003e\n\u003e//to QUuid\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultUuid();\n\u003e\n\u003e//to QVariantList\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultList();\n\u003e\n\u003e//to QStringList\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultStringList();\n\u003e\n\u003e//to QVariantHash\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultHash();\n\u003e\n\u003e//to QVariantMap\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultMap();\n\u003e\n\u003e//to void*\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultObject();\n\u003e\n\u003e//to QObject\n\u003eqWarning()\u003c\u003csimpleObject.lr().resultObject\u003cQObject*\u003e();\u003e\n\u003e```\n\u003e## QStm::Object\n\u003eBased on ***QObject*** contains functions to convert to type ***QVariant*** and assigned values ​​of ***QVariantHash***\n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003eclass MyFirstObject : public QStm::Object {\n\u003e    Q_OBJECT\n\u003e\n\u003e    Q_PROPERTY(QUuid uuid MEMBER _uuid NOTIFY uuidChanged)\n\u003e    Q_PROPERTY(QString name MEMBER _name NOTIFY nameChanged)\n\u003e    \n\u003epublic:\n\u003e    Q_INVOKABLE explicit MyFirstObject(QObject*parent=nullptr):QStm::Object(parent)\n\u003e    {\n\u003e    }\n\u003e\n\u003esignals:\n\u003e    void uuidChanged();\n\u003e    void nameChanged();\n\u003e\n\u003eprivate:\n\u003e    QUuid _uuid;\n\u003e    QString _name;\n\u003e};\n\u003e\n\u003evoid run()\n\u003e{\n\u003e    MyFirstObject myFirstObject;\n\u003e\n\u003e    QVariantHash vHash=myFirstObject.toHash();//include QMetaProperty in QVariantHash\n\u003e    qWarning()\u003c\u003cvHash;\n\u003e    //ouput is QVariantHash{ {\"uuid\", QUuid(...)}, {\"name\", QString(...)} }\n\u003e}\n\u003e```\n\u003e## QStm::QCurrency\n\u003eBased on ***bcmath*** is a ***QVariant*** type, used to manipulate currency values ​​without difficulty the type ***double***\n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003evoid Util::usingQCurrency()\n\u003e{\n\u003e    QCurrency currency;\n\u003e    currency=1.5464137891;\n\u003e    qWarning()\u003c\u003ccurrency.toString();\n\u003e    //output is 1.45\n\u003e   \n\u003e    currency=1;\n\u003e    currency+=0.5464137891;\n\u003e    qWarning()\u003c\u003ccurrency.toString();\n\u003e    //output is 1.45\n\u003e  \n\u003e    currency+=1;\n\u003e    qWarning()\u003c\u003ccurrency.toString();\n\u003e    //output is 2.45\n\u003e    \n\u003e    currency-=1;\n\u003e    qWarning()\u003c\u003ccurrency.toString();\n\u003e    //output is 1.45\n\u003e    \n\u003e    currency+=1;\n\u003e    currency/=1;\n\u003e    qWarning()\u003c\u003ccurrency.toString();\n\u003e    //output is 1.00\n\u003e}\n\u003e```\n\u003e## QStm::VariantUtil\n\u003eBased on ***QVariant***, used to manipulate ***QVariant*** types.\n\u003e\u003eSimplify conversion of json values em ***QVariantList*** and ***QVariantHash***.\n\u003e\u003eSimplify conversion of ***QVariant*** to others ***QVariant*** types.\n\u003e\u003eFunctions to handle md5 and uuid values ​​for ***QVariant***\n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003evoid Util::usingVariantUtil()\n\u003e{\n\u003e    VariantUtil vu;\n\u003e\n\u003e    {// json conversion\n\u003e\n\u003e        //list json bytes\n\u003e        auto bytesList=\"{\\\"row 1\\\",\\\"row 2\\\",\\\"row 2\\\"}\";\n\u003e\n\u003e        //identify and convert to QVariantList\n\u003e        QVariantList vList=vu.toList(bytesList);\n\u003e\n\u003e        qWarning()\u003c\u003cvList;//output QVariantList\n\u003e\n\u003e        //identify and convert to QStringList\n\u003e        QStringList vStringList=vu.toStringList(bytesList);\n\u003e\n\u003e        qWarning()\u003c\u003cvStringList;//output QStringList\n\u003e\n\u003e\n\u003e        //object json bytes\n\u003e        auto bytesMap=\"{\\\"rows\\\":{\\\"row 1\\\",\\\"row 2\\\",\\\"row 2\\\"}}\";\n\u003e\n\u003e        //identify and convert to QVariantHash\n\u003e        QVariantHash vHash=vu.toHash(bytesMap);\n\u003e        qWarning()\u003c\u003cvHash;//output QVariantList\n\u003e\n\u003e        //identify and convert to QVariantList\n\u003e        QVariantMap vMap=vu.toMap(bytesMap);\n\u003e\n\u003e        qWarning()\u003c\u003cvMap;//output QStringList\n\u003e    }\n\u003e\n\u003e    {// QVariant conversion to QString and bytes JSON\n\u003e\n\u003e        //QVariantList object\n\u003e        auto objectList=QVariantList{\"row 1\",\"row 2\",\"row 2\"};\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(objectList);//output JSON bytes\n\u003e\n\u003e        //QVariantHash object\n\u003e        auto objectMap=QVariantHash{{\"rows\", QStringList{\"row 1\",\"row 2\",\"row 2\"}}};\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(objectMap);//output JSON bytes\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(QString(\"abcd\"));//output QString using QVariant::toString()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(12345);//output QString using QVariant::toString()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(12345.6789);//output QString using QVariant::toString()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(QUrl(\"file:///tmp/tmp.txt\"));//output QString using QVariant::toUrl().toString()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(QUuid::createUuid());//output QString using QVariant::toUuid().toString()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(QDate::currentDate());//output QString using QVariant::toDate().toString()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(QTime::currentTime());//output QString using QVariant::toTime().toString()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toStr(QDateTime::currentDateTime());//output QString using QVariant::toDateTime().toString()\n\u003e    }\n\u003e\n\u003e    {// QString conversion to QVariant types\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toInt(\"1\");//output QVariant::toInt()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toLongLong(\"1\");//output QVariant::toLongLong()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toLongLong(\"1\");//output QVariant::toLongLong()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toDouble(\"1.1\");//output QVariant::toDouble()\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toDate(\"1901-01-01\");//output QDate::fromString(...);\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toTime(\"00:00:01.999\");//output QTime::fromString(...);\n\u003e\n\u003e        qWarning()\u003c\u003cvu.toDateTime(\"1901-01-01T00:00:01.999\");//output QDateTime::fromString(...);\n\u003e    }\n\u003e}\n\u003e```\n\u003e## QStm::FormattingUtil\n\u003eBased on ***QVariant***, using masks to manipulate ***QVariant*** formatting values to especific types ***QDateTime, QDate, QTime, QCurrence, Double, Int, ....*** .\n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003evoid Util::usingFormattingUtil()\n\u003e{\n\u003e    FormattingUtil fu;\n\u003e\n\u003e    qWarning()\u003c\u003cfu.v(12.12);//output identify QVariant type and auto format value\n\u003e\n\u003e    qWarning()\u003c\u003cfu.toDate(QDate(1901,01,01));//output QVariant::toDate().toString(/*using QLocale::c() masks*/);\n\u003e\n\u003e    qWarning()\u003c\u003cfu.toTime(QTime(00,00,01,999));//output QVariant::toTime().toString(/*using QLocale::c() masks*/);\n\u003e\n\u003e    qWarning()\u003c\u003cfu.toDateTime(QDateTime(QDate(1901,01,01),QTime(00,00,01,999)));//output QVariant::toDateTime().toString(/*using QLocale::c() masks*/);\n\u003e\n\u003e    qWarning()\u003c\u003cfu.toInt(12);//output using QLocale::c().toString(QVariant::toInt(),'f',0)\n\u003e\n\u003e    qWarning()\u003c\u003cfu.toDouble(12.12);//output using QLocale::c().toString(QVariant::toDouble(),'f',6)\n\u003e\n\u003e    qWarning()\u003c\u003cfu.toCurrency(12.12);//output using QLocale::c().toString(QVariant::toDouble(),'f',2)\n\u003e}\n\u003e```\n\u003e## QStm::DateUtil\n\u003eBased on ***QVariant***, use to manipulate then types ***QDateTime, QDate, QTime***, contains functions to calculate datestime, ex: months, years, ranges and others. \n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003evoid run()\n\u003e{\n\u003e     ...more\n\u003e}\n\u003e```\n\u003e## QStm::DoubleUtil\n\u003eBased on ***QVariant***, use to manipulate then types ***QCurrency, double, int, qlonglong***, contains functions to calculate numeric values, ex: conversions, ranges and others. \n\u003e```c++\n\u003e#include \u003cQStm\u003e\n\u003e\n\u003evoid Util::usingDoubleUtil()\n\u003e{\n\u003e    DoubleUtil dbu;\n\u003e\n\u003e    {//rearrange values\n\u003e        double vMin=2;\n\u003e        double vMax=1;\n\u003e        qWarning()\u003c\u003cdbu.checkBetween(vMin, vMax);//return true, function arrange max and min values\n\u003e    }\n\u003e\n\u003e    {//check and rearrange values\n\u003e        double vVal=1.5;\n\u003e        double vMin=2;\n\u003e        double vMax=1;\n\u003e        qWarning()\u003c\u003cdbu.checkBetween(vVal, vMin, vMax);//return true, function arrange max/min values and validate value\n\u003e    }\n\u003e}\n\u003e```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaviomarcio%2Fqstm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflaviomarcio%2Fqstm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflaviomarcio%2Fqstm/lists"}