1. config — Configuration facilities

Qt BRisa provides a very simple configuration API, just like BRisa Python does.

You can create Configuration Managers using the BrisaConfigurationManager class (from BrisaCore). Using this class you are able to set and get parameters in an easy way. Also, you can save the configuration and use it later.

Here is an example on how to use BrisaConfigurationManager class

1.1. Using the Built-In Configuration Manager

QString configPath("./");

// Generating my own configuration
QHash<QString,QString> state;
state["brisaPython.owner"] = "owner1";
state["brisaPython.version"] = "0.10.0";
state["brisaPython.encoding"] = "utf-8'";
state["brisaC++.owner"] = "owner2";
state["brisaC++.version"] = "0.1.0";
state["brisaC++.encoding"] = "utf-8";

// Creating a  BrisaConfigurationManager object using the generated configuration
BrisaConfigurationManager *myConfig = new BrisaConfigurationManager(configPath, state);

// Saving the config manager

// Checking brisaC++.owner parameter value and changing it
qDebug() << "value: " << myConfig->getParameter("brisaC++","owner");
myConfig->setParameter("brisaC++", "owner", "newOwner");


// Updating the config

qDebug() << "value: " << myConfig->getParameter("brisaC++","owner");

The output should be

value:  "owner2"
value:  "newOwner"

Table Of Contents

Previous topic

4. core-utils — Framework’s core and utils

Next topic

2. log — Logging facilities

This Page