File: example.cpp

package info (click to toggle)
kweathercore 25.04.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,064 kB
  • sloc: cpp: 3,507; xml: 681; sh: 8; makefile: 5
file content (24 lines) | stat: -rw-r--r-- 637 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * SPDX-FileCopyrightText: 2020-2021 Han Young <hanyoung@protonmail.com>
 *
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */
#include <KWeatherCore/WeatherForecastSource>
using namespace KWeatherCore;

//...

// Get the weatherforecast of Paris
WeatherForecastSource m_source;

auto m_pendingForecast = m_source.requestData(48.86, 2.34);

connect(m_pendingForecast, &PendingWeatherForecast::finished, [m_pendingForecast] {
    auto m_weatherData = m_pendingForecast->value();
    m_pendingForecast->deleteLater();
});
connect(m_pendingForecast, &PendingWeatherForecast::networkError, [] {
    qDebug() << "network error";
});

//...