Skip to content
  • 0 Votes
    2 Posts
    254 Views
    S

    Use QStandardPaths::writeableLocation to find the proper location. Use QDir and QFile to finish the save.

  • 1 Votes
    3 Posts
    406 Views
    KH-219DesignK

    I think it depends on Android OS version. For the latest version(s), I suspect @J-Hilk is 100% correct.

    Would the Downloads folder be acceptable? You might have a look at my "cynical" (my words), pessimistic approach described on an older forum thread:

    https://forum.qt.io/post/675910

  • 0 Votes
    3 Posts
    584 Views
    K

    @Pablo-J-Rogina i looked through its documentation and i am afraid that it returns only internal storage paths.

  • 0 Votes
    4 Posts
    825 Views
    ODБOïO

    @BzhAx hi,

    @BzhAx said in Save whole context:

    I don't know if this is the best way to do it..

    it works ? do you have errors ?

    You can have your TabButtons in ListModel and use this method :
    https://stackoverflow.com/questions/48730166/how-to-save-and-restore-the-content-of-a-listmodel?rq=1

  • 0 Votes
    4 Posts
    3k Views
    T

    Since you seem to have some problems with QRegularExpression (Read the documentation! It's the best I have ever seen!), I will give you a small example. I happen to be using something like this in a program I am working on:

    QRegularExpression re("<img (?<junk>.*?) src=(?<path>\\S+?) (?<junk2>.*?)>"), QRegularExpression::CaseInsensitiveOption);

    The ?<name>-blocks are there to provide named captures in the matches. The first one is called junk - it is allowed to contain anything but the "src"-attribute (.*? matches any sign in a "lazy" manner). junk2 behaves equivalently; if you don't need to capture (i.e. store for later access) these groups, you could simplify the expression a bit.
    path will be storing the download-link for the image. \\S will match every non-whitespace character, +? means that there has to be at least one character like that. You will have to adapt to path including "-signs, depends on your specific case.

    Here a bit of code I copied and slightly modified from the documentation for QRegularExpression:

    QString s = "<img style=\"background-repeat: no-repeat; background-size: 100% 100%; vertical-align: -0.838ex;height: 2.843ex;\" src=http://en.wikitolearn.org/index.php?title=Special:MathShowImage&hash=2af9544640fe8b97375512027efaaccd&mode=mathml>"; QRegularExpressionMatch match = re.match(s); while (match.hasMatch()) { QString junk = match.captured("junk"); // junk == style=\"background-repeat: no-repeat; background-size: 100% 100%; vertical-align: -0.838ex;height: 2.843ex;\" QString junk2 = match.captured("junk2"); // junk2 == "" QString path = match.captured("path"); // path == http://en.wikitolearn.org/index.php?title=Special:MathShowImage&hash=2af9544640fe8b97375512027efaaccd&mode=mathml }

    Hand in your html-file instead of s, take care of some minute details (path enclosed in " or not? Maybe no space before junk2? etc.), and then you should be able to do whatever you want with your links.
    I hope that gets you started.

  • 0 Votes
    5 Posts
    3k Views
    QjayQ

    It's just that i had a thought i can write this whole application with QML/JS . SO i was trying to stick to it .

    But now it seems i will have to use C++ .

  • 0 Votes
    3 Posts
    3k Views
    McLionM

    @SGaist
    I'm not sure, but I believe solid needs udev. I'm using busybox with mdev.
    However, I found a solution with find and grep.
    If I know I have to find where, for instance, sda is connected on my 4 ports:

    find /sys/bus/usb/devices/usb*/ -name dev -path "*usb1*sd*" | grep -E sda
    find /sys/bus/usb/devices/usb*/ -name dev -path "*usb2-1.1*sd*" | grep -E sda
    find /sys/bus/usb/devices/usb*/ -name dev -path "*usb2-1.2*sd*" | grep -E sda
    find /sys/bus/usb/devices/usb*/ -name dev -path "*usb2-1.4*sd*" | grep -E sda

    The return value is 1 if there is no entry matching and 0 if there is.
    I wrapped this in a function with sd_ as variable and it works as supposed.

    Cheers,
    McL