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. QDBus path encoding

QDBus path encoding

Scheduled Pinned Locked Moved Unsolved General and Desktop
qdbus
4 Posts 2 Posters 513 Views
  • 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.
  • C Offline
    C Offline
    Chruetli
    wrote on 1 May 2022, 08:19 last edited by
    #1

    Hi

    I'm moving from libsystemd-dev to QDBus. I have to get the state of a customer service called "application-ui.service". Du to the special characters I had to use sd_bus_path_encode to encode the path. This results in "application_2dui_2eservice".
    Is there an equivalent method in Qt available?

    Best regards
    Mario

    C 1 Reply Last reply 5 May 2022, 11:34
    0
    • C Chruetli
      1 May 2022, 08:19

      Hi

      I'm moving from libsystemd-dev to QDBus. I have to get the state of a customer service called "application-ui.service". Du to the special characters I had to use sd_bus_path_encode to encode the path. This results in "application_2dui_2eservice".
      Is there an equivalent method in Qt available?

      Best regards
      Mario

      C Offline
      C Offline
      Chruetli
      wrote on 5 May 2022, 11:34 last edited by
      #2

      @Chruetli no one stumbled across this problem?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        SGaist
        Lifetime Qt Champion
        wrote on 5 May 2022, 18:44 last edited by
        #3

        Hi,

        One would likely use QString::replace once for each char you want to replace or this overload with a QRegularExpression.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • C Offline
          C Offline
          Chruetli
          wrote on 6 May 2022, 14:59 last edited by
          #4

          Thank you for the answer. Honestly I expected this as some kind of magic done in background...
          At the moment I will use the sd_bus_path_encode function.
          The source of the function can be found at https://github.com/systemd/systemd/blob/main/src/basic/bus-label.c called bus_label_escape.

          1 Reply Last reply
          0

          3/4

          5 May 2022, 18:44

          • Login

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