Hello every1!
I have this code:
I know the ,,foreach" will go through all my document, but i dont want thatCode:
class Model { public: Model(const QString& path); double getVehicleWeight() { m_settings->beginGroup("vehicle"); { //Here I want to return a double using QVariant, each line of my config file have (ex: weight = 60) } m_settings->endGroup(); } private: void initSettings(const QString& path); protected: std::unique_ptr<QSettings> m_settings; }; Model::Model(const QString& path) { initSettings(path); } void Model::initSettings(const QString& path) { } int main() { Model obj("/d/users/F27279C/Desktop/TESTINI/TestINI/New folder"); qDebug() << "PLS WORK!"; obj.getVehicleWeight(); }
I want ot make a getter for every line of my config file which will return the value from it
All the values are double
so what I ask is:
- how can I access a specific line of my config for ex weight or speed?
- how can I return a double using QVariant?
thx for help!