Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSettings->setValue , group contains space will save to %20 ?
Forum Updated to NodeBB v4.3 + New Features

QSettings->setValue , group contains space will save to %20 ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sonichyS Offline
    sonichyS Offline
    sonichy
    wrote on last edited by
    #1

    If group contains space will save to %20, in Desktop Entry file of Linux will display mess code.

    writeSettings(filePath, "Desktop Entry", "Name", ui->lineEditName->text());
    
    void MainWindow::writeSettings(QString path, QString group, QString key, QString value)
    {
        QSettings *settings = new QSettings(path, QSettings::IniFormat);
        settings->setIniCodec("UTF-8");
        settings->beginGroup(group);
        settings->setValue(key, value);
        settings->endGroup();
    }
    

    [Desktop%20Entry]
    Name=KuWo
    ......

    https://github.com/sonichy

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      From http://doc.qt.io/qt-5/qsettings.html#Format-enum :

      The INI file format has severe restrictions on the syntax of a key. Qt works around this by using % as an escape character in keys.

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      6

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved