Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 67 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. #include <QtGui/QApplication>
  2. #include <QSettings>
  3. #include <QDebug>
  4. #include <QStringList>
  5. #include "mainwindow.h"
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9.     QApplication a(argc, argv);
  10.  
  11.     QSettings settings("akabei.conf", QSettings::NativeFormat);
  12.     settings.beginGroup("Options");
  13.     if (!settings.value("RootDir").isNull())
  14.         qDebug() << settings.value("RootDir").toString();
  15.     if (!settings.value("CacheDir").isNull())
  16.         qDebug() << settings.value("CacheDir").toString();
  17.     if (!settings.value("DatabaseDir").isNull())
  18.         qDebug() << settings.value("DatabaseDir").toString();
  19.     if (!settings.value("LogFile").isNull())
  20.         qDebug() << settings.value("LogFile").toString();
  21.     settings.endGroup();
  22.  
  23.     QStringList servers;
  24.  
  25.     settings.beginGroup("Repositories");
  26.     foreach (const QString &repositories, settings.childGroups()) {
  27.         int size = settings.beginReadArray(repositories);
  28.         qDebug() << repositories << size;
  29.         for (int i = 0; i < size; ++i) {
  30.             settings.setArrayIndex(i);
  31.             qDebug() << settings.value("Server").toString();
  32.             servers.append(settings.value("Server").toString());
  33.         }
  34.         settings.endArray();
  35.     }
  36.     settings.endGroup();
  37.  
  38.     return 0;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top