Qt World Summit: Submit your Presentation

XDG Desktop portal in Qt

  • I'm trying to open file in a Qt app via org.freedesktop.portal.FileChooser. So far it works the thing I'm stuck with is the filters.

    The doc say to use the format filters a(sa(us))

    QDBusMessage message = QDBusMessage::createMethodCall(
    message << QLatin1String("x11:") << QLatin1String("Open PDF File") <<
    QVariantMap {
            {QLatin1String("handle_token"), getRequestToken()},
            {QLatin1String("multiple"), false},
             {QLatin1String("filters"), QVariantMap {
             {QLatin1String ("PDF File"), QVariantList {

    Can some help me how to write a filter for PDF file.

  • Lifetime Qt Champion


    Not a direct answer but why not use QDesktopService::openUrl ?

    Or are you trying to make your app open that file type ?

Log in to reply