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. Get variables from QString by type model

Get variables from QString by type model

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 623 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.
  • P Offline
    P Offline
    pVit
    wrote on last edited by
    #1

    Hello,
    I need to get variables from QString by my type model.
    Explanation of the example:

    QProcess starts sudo iwconfig wlan0.
    Output:
    wlan0 IEEE 802.11bgn ESSID:"ENWOX"
    Mode:Managed Frequency:2.462 GHz Access Point: --:--:--:--:--:--
    Bit Rate=72 Mb/s Tx-Power=1496 dBm
    Retry short limit:7 RTS thr:off Fragment thr:off
    Power Management:off
    Link Quality=68/70 Signal level=-42 dBm
    Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
    Tx excessive retries:0 Invalid misc:0 Missed beacon:0

    QProcess output inserted to QTextStream, then I test lines (contain ESSID, Signal level etc.).

    Then
    I need to get ESSID, so I need something like get it by mask ESSID:"%1".
    I need signal level, something like Signal level=%1 dBm.
    I need AP, something like Access Point: %1.%2.%3.%4.%5.%6
    ...etc.

    Do you know how to do that?

    Thanks for help

    jsulmJ 1 Reply Last reply
    0
    • P pVit

      Hello,
      I need to get variables from QString by my type model.
      Explanation of the example:

      QProcess starts sudo iwconfig wlan0.
      Output:
      wlan0 IEEE 802.11bgn ESSID:"ENWOX"
      Mode:Managed Frequency:2.462 GHz Access Point: --:--:--:--:--:--
      Bit Rate=72 Mb/s Tx-Power=1496 dBm
      Retry short limit:7 RTS thr:off Fragment thr:off
      Power Management:off
      Link Quality=68/70 Signal level=-42 dBm
      Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
      Tx excessive retries:0 Invalid misc:0 Missed beacon:0

      QProcess output inserted to QTextStream, then I test lines (contain ESSID, Signal level etc.).

      Then
      I need to get ESSID, so I need something like get it by mask ESSID:"%1".
      I need signal level, something like Signal level=%1 dBm.
      I need AP, something like Access Point: %1.%2.%3.%4.%5.%6
      ...etc.

      Do you know how to do that?

      Thanks for help

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @pVit What you need are regular expressions.
      Take a look at http://doc.qt.io/qt-5.7/qregularexpression.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      P 1 Reply Last reply
      5
      • jsulmJ jsulm

        @pVit What you need are regular expressions.
        Take a look at http://doc.qt.io/qt-5.7/qregularexpression.html

        P Offline
        P Offline
        pVit
        wrote on last edited by
        #3

        @jsulm
        Thank You very much, this is what I was looking for.

        1 Reply Last reply
        0

        • Login

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