Skip to content
QtWS25 Last Chance
  • 0 Votes
    2 Posts
    339 Views
    S
    Use QStandardPaths::writeableLocation to find the proper location. Use QDir and QFile to finish the save.
  • Android permanent storage

    Solved Mobile and Embedded android qstandardpaths storage
    3
    1 Votes
    3 Posts
    527 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
  • How to get path to SD card

    Unsolved Mobile and Embedded sdcard storage android
    3
    0 Votes
    3 Posts
    690 Views
    K
    @Pablo-J-Rogina i looked through its documentation and i am afraid that it returns only internal storage paths.
  • Save whole context

    Unsolved QML and Qt Quick save load program context storage
    4
    0 Votes
    4 Posts
    952 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
  • Download all images from an HTML file

    Unsolved General and Desktop qnetwork file storage image download
    4
    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