#include <QUrlQuery>
#include <QDebug>

int main() {
    // 创建一个查询对象
    QUrlQuery query;
    query.addQueryItem("name", "Alice");
    query.addQueryItem("age", "30");
    query.addQueryItem("city", "NewYork");
    query.addQueryItem("gender", "female");

    // 获取指定键对应的值
    QString name = query.queryItemValue("name");
    QString age = query.queryItemValue("age");
    QString country = query.queryItemValue("country");

    // 输出获取到的值
    qDebug() << "Name:" << name; // 输出：Alice
    qDebug() << "Age:" << age;   // 输出：30
    qDebug() << "Country:" << country; // 输出：空字符串

    return 0;
}
