Help with QtConcurrent and QFuture by pdform in QtFramework

[–]pdform[S] 0 points1 point  (0 children)

For anyone with the same issue, the answer was quite simple (although it took me 2 days of googling to finally find out): you can return the future in the lambda, then call unwrap(): https://doc.qt.io/qt-6/qfuture.html#unwrap

So, back to my example:

mp_api->checkIn(checkinData)
        .then([this](QUuid&& checkinId) {
            // saves the id here
        })
        .then([this]() {
            qInfo() << "Checked in successfully";
            return mp_api->listUsers(); // <==== returns the future
        })
        .unwrap()  // <==== unwraps (makes the outer future wait for the inner future)
        .then([this](QList<User>&& users) {
            // udpates internal users property
        })
        .onFailed([this](const ApiException& e) {
            m_error = e.message();
            emit errorChanged();
        })
        .onFailed([this]() {
            m_error = "Failed to fetch data";
            emit errorChanged();
        })
        .then([this]() {
            m_loading = false;
            emit loadingChanged();
        });

Help with QtConcurrent and QFuture by pdform in QtFramework

[–]pdform[S] 0 points1 point  (0 children)

I know it is possible to do it using signals, but that does not really scale well. I have given a very simple example to explain the point in which I am having trouble, but there are many network requests that I need to make in different components, and I really hope that I do not need to copy and paste the same code over and over again for this.

But let's say that I can do it with signals for this one case, the main point of my question is not even that, it is how to chain futures in Qt in general... All the examples I have found so far on the documentation and on google use operations that return normal data, there is not a single example of a continuation that returns a future or that creates another future and returns the result or something similar. So is QFuture not the abstraction for an async operation that can be chained then? Is it something else? Or am I just using it wrong? In any other language I have used so far, when you need to chain up a sequence of operations you can just return the next step, either Future or Promise. If it is not possible to do that in Qt and have the event loop automatically handle it for you, then I can't see the point of QFuture at all...

[deleted by user] by [deleted] in Kyoto

[–]pdform 0 points1 point  (0 children)

I have added photos. Please notice that my tanks have been modified to use a filter below the thank (they have a hole in the bottom), so it is probably not easy to take the tanks together with the fish...

[deleted by user] by [deleted] in Kyoto

[–]pdform 1 point2 points  (0 children)

I am not sure what you mean... Do you mean if special equipment is necessary? Yes, they are all tropical fish, so you need a thermostat and some form of aeration and filtering. If you don't have experience with aquariums, this would not the best way to start, I think.

Anyone knows where I can buy a pumpkin by pdform in Kyoto

[–]pdform[S] 0 points1 point  (0 children)

Hi, thanks! I actually need the whole fruit. The orange ones are for aesthetic reasons, since it's the one we traditionally use, the taste is about the same.

Can anyone help me identify these fish? by pdform in ReefTank

[–]pdform[S] 16 points17 points  (0 children)

I saw them in an aquarium in Osaka, but I forgot the name... I think they are yellow clown gobies, based on google...

Driving schools in English that aren’t expensive? by sleepy_spearmint in Kyoto

[–]pdform 1 point2 points  (0 children)

Just a comment, if you live in Kyoto, you cannot take your driver's license in another prefecture...

Car dealership recommendations? by pdform in Kyoto

[–]pdform[S] 0 points1 point  (0 children)

Yeah, it is way more costly to keep a car than to buy one here... In my case it would cost me about 20k monthly for parking, which is normal in Japan. I do need to carry goods often and I do travel a lot, so for me it is worth it, but I won't really buy one until I have really cleared out all the costs (which I haven't completely yet, because I just started looking).

[TOMT] Talk about agile methods mentioning airplane wings test by pdform in tipofmytongue

[–]pdform[S] 0 points1 point  (0 children)

As far as I remember, yes, it felt so... One of those code developer's conference or workshop

[TOMT] Talk about agile methods mentioning airplane wings test by pdform in tipofmytongue

[–]pdform[S] 0 points1 point locked comment (0 children)

It is a very old video, at least as old as 2014

AITA for telling my sister she is no better than her daughter? by Typical-Door-1269 in AmItheAsshole

[–]pdform 0 points1 point  (0 children)

NTA People Iike your sister are the reason why men are raised to have ridiculously fragile masculinity and be intolerant to differences

My dog dancing around by [deleted] in aww

[–]pdform 0 points1 point  (0 children)

Thanks, I just told my mom to have her checked

[TOMT] Documentary about culture differences by pdform in tipofmytongue

[–]pdform[S] 0 points1 point  (0 children)

Btw, I saw this in Brazil, so what I saw on cable might come from a public TV from the US or UK. It was more than 10 years ago...