Qt World Summit: Submit your Presentation

Get variables from QString by type model

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

    QProcess starts sudo iwconfig wlan0.
    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.).

    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

    Do you know how to do that?

    Thanks for help

  • Lifetime Qt Champion

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

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

Log in to reply